!UUYziobKGGxpovWyAN:nixos.org

Robotnix

244 Members
Build Android (AOSP) using Nix | https://github.com/danielfullmer/robotnix75 Servers

Load older messages


SenderMessageTime
5 Sep 2021
@samueldr:matrix.orgsamueldr --arg already requires arguments to be named and present in the attrset pattern argument 19:18:04
@samueldr:matrix.orgsamueldrso it would make sense to have it apply until it can't in deeper nested function calls?19:18:45
@kranzes:matrix.orgkranzes
In reply to @danielrf:matrix.org
diff --git a/flavors/lineageos/default.nix b/flavors/lineageos/default.nix
index 1216ca8..5407fc8 100644
--- a/flavors/lineageos/default.nix
+++ b/flavors/lineageos/default.nix
@@ -106,9 +106,9 @@ in mkIf (config.flavor == "lineageos")
         })
       ];
 
-      # LineageOS will sometimes force-push to this repo, and the older revisions are garbage collected.
-      # So we'll just build chromium webview ourselves.
-      "external/chromium-webview".enable = false;
+#      # LineageOS will sometimes force-push to this repo, and the older revisions are garbage collected.
+#      # So we'll just build chromium webview ourselves.
+#      "external/chromium-webview".enable = false;
     }
   ] ++ optionals (deviceMetadata ? "${config.device}") [
     # Device-specific source dirs
@@ -134,16 +134,16 @@ in mkIf (config.flavor == "lineageos")
   source.manifest.url = mkDefault "https://github.com/LineageOS/android.git";
   source.manifest.rev = mkDefault "refs/heads/${LineageOSRelease}";
 
-  # Enable robotnix-built chromium / webview
-  apps.chromium.enable = mkDefault true;
-  webview.chromium.availableByDefault = mkDefault true;
-  webview.chromium.enable = mkDefault true;
-
-  # This is the prebuilt webview apk from LineageOS. Adding this here is only
-  # for convenience if the end-user wants to set `webview.prebuilt.enable = true;`.
-  webview.prebuilt.apk = config.source.dirs."external/chromium-webview".src + "/prebuilt/${config.arch}/webview.apk";
-  webview.prebuilt.availableByDefault = mkDefault true;
-  removedProductPackages = [ "webview" ];
+#  # Enable robotnix-built chromium / webview
+#  apps.chromium.enable = mkDefault true;
+#  webview.chromium.availableByDefault = mkDefault true;
+#  webview.chromium.enable = mkDefault true;
+#
+#  # This is the prebuilt webview apk from LineageOS. Adding this here is only
+#  # for convenience if the end-user wants to set `webview.prebuilt.enable = true;`.
+#  webview.prebuilt.apk = config.source.dirs."external/chromium-webview".src + "/prebuilt/${config.arch}/webview.apk";
+#  webview.prebuilt.availableByDefault = mkDefault true;
+#  removedProductPackages = [ "webview" ];
 
   # Needed by included kernel build for some devices (pioneer at least)
   envPackages = [ pkgs.openssl.dev ] ++ optionals (config.androidVersion == 11) [ pkgs.gcc.cc pkgs.glibc.dev ];
what does source.manifest do exactly? its still on LineageOS instead of ForkLineageOS?
19:19:44
@danielrf:matrix.orgdanielrf source.manifest is only used if source.evalTimeFetching is enabled (which is an old system that's largely untested these days). Arguably we should remove those options since they aren't being used. 19:22:13
@danielrf:matrix.orgdanielrfSee last section of https://docs.robotnix.org/modules/source.html19:22:36
@kranzes:matrix.orgkranzesI'm not exactly sure what i need to comment out again19:22:55
@kranzes:matrix.orgkranzes
# SPDX-FileCopyrightText: 2020 Daniel Fullmer and robotnix contributors
# SPDX-License-Identifier: MIT

{ config, pkgs, lib, ... }:
let
  inherit (lib)
    optional optionals optionalString optionalAttrs
    elem mapAttrs mapAttrs' nameValuePair filterAttrs
    attrNames getAttrs flatten remove
    mkIf mkMerge mkDefault mkForce
    importJSON toLower hasPrefix;

  androidVersionToLineageBranch = {
    "10" = "lineage-17.1";
    "11" = "lineage-18.1";
  };
  lineageBranchToAndroidVersion = mapAttrs' (name: value: nameValuePair value name) androidVersionToLineageBranch;

  deviceMetadata = lib.importJSON ./device-metadata.json;
  LineageOSRelease = androidVersionToLineageBranch.${builtins.toString config.androidVersion};
  repoDirs = lib.importJSON (./. + "/${LineageOSRelease}/repo.json");
  _deviceDirs = importJSON (./. + "/${LineageOSRelease}/device-dirs.json");
  vendorDirs = importJSON (./. + "/${LineageOSRelease}/vendor-dirs.json");

  # TODO: Condition on soc name?
  dtbReproducibilityFix = ''
    sed -i \
      's/^DTB_OBJS := $(shell find \(.*\))$/DTB_OBJS := $(sort $(shell find \1))/' \
      arch/arm64/boot/Makefile
  '';
  kernelsNeedFix = [
    # Only verified marlin reproducibility is fixed by this, however these other repos have the same issue
    "kernel/asus/sm8150"
    "kernel/bq/msm8953"
    "kernel/essential/msm8998"
    "kernel/google/marlin"
    "kernel/leeco/msm8996"
    "kernel/lge/msm8996"
    "kernel/motorola/msm8996"
    "kernel/motorola/msm8998"
    "kernel/motorola/sdm632"
    "kernel/nubia/msm8998"
    "kernel/oneplus/msm8996"
    "kernel/oneplus/sdm845"
    "kernel/oneplus/sm8150"
    "kernel/razer/msm8998"
    "kernel/samsung/sdm670"
    "kernel/sony/sdm660"
    "kernel/xiaomi/jason"
    "kernel/xiaomi/msm8998"
    "kernel/xiaomi/sdm660"
    "kernel/xiaomi/sdm845"
    "kernel/yandex/sdm660"
    "kernel/zuk/msm8996"
  ];
  # Patch kernels
  patchKernelDir = n: v: v // (optionalAttrs (hasPrefix "kernel/" n) {
    patches = config.kernel.patches;
    postPatch = config.kernel.postPatch
      + optionalString (config.useReproducibilityFixes && (elem n kernelsNeedFix)) ("\n" + dtbReproducibilityFix);
  });
  deviceDirs = mapAttrs patchKernelDir _deviceDirs;

  supportedDevices = attrNames deviceMetadata;

  # TODO: Move this filtering into vanilla/graphene
  filterDirAttrs = dir: filterAttrs (n: v: elem n [ "rev" "sha256" "url" "patches" "postPatch" ]) dir;
  filterDirsAttrs = dirs: mapAttrs (n: v: filterDirAttrs v) dirs;
in
mkIf (config.flavor == "lineageos")
{
  androidVersion =
    let
      defaultBranch = deviceMetadata.${config.device}.branch;
    in
    mkIf (deviceMetadata ? ${config.device}) (mkDefault (lib.toInt lineageBranchToAndroidVersion.${defaultBranch}));

  productNamePrefix = "lineage_"; # product names start with "lineage_"

  buildDateTime = mkDefault 1628634098;

  # LineageOS uses this by default. If your device supports it, I recommend using variant = "user"
  variant = mkDefault "userdebug";

  warnings = optional
    (
      (config.device != null) &&
      !(elem config.device supportedDevices) &&
      (config.deviceFamily != "generic")
    )
    "${config.device} is not an officially-supported device for LineageOS";

  source.dirs = mkMerge ([
    repoDirs

    {
      "vendor/lineage".patches = [
        ./0001-Remove-LineageOS-keys.patch
        (pkgs.substituteAll {
          src = ./0002-bootanimation-Reproducibility-fix.patch;
          inherit (pkgs) imagemagick;
        })
        ./0003-kernel-Set-constant-kernel-timestamp.patch
      ];
      "system/extras".patches = [
        # pkgutil.get_data() not working, probably because we don't use their compiled python
        (pkgs.fetchpatch {
          url = "https://github.com/LineageOS/android_system_extras/commit/7da4b29321eb7ebce9eb9a43d0fbd85d0aa1e870.patch";
          sha256 = "0pv56lypdpsn66s7ffcps5ykyfx0hjkazml89flj7p1px12zjhy1";
          revert = true;
        })
      ];

      # LineageOS will sometimes force-push to this repo, and the older revisions are garbage collected.
      # So we'll just build chromium webview ourselves.
      #      "external/chromium-webview".enable = false;
    }
  ] ++ optionals (deviceMetadata ? "${config.device}") [
    # Device-specific source dirs
    (
      let
        vendor = toLower deviceMetadata.${config.device}.vendor;
        relpathWithDependencies = relpath: [ relpath ] ++ (flatten (map (p: relpathWithDependencies p) deviceDirs.${relpath}.deps));
        relpaths = relpathWithDependencies "device/${vendor}/${config.device}";
        filteredRelpaths = remove (attrNames repoDirs) relpaths; # Remove any repos that we're already including from repo json
      in
      filterDirsAttrs (getAttrs filteredRelpaths deviceDirs)
    )

    # Vendor-specific source dirs
    (
      let
        _vendor = toLower deviceMetadata.${config.device}.vendor;
        vendor = if config.device == "shamu" then "motorola" else _vendor;
        relpath = "vendor/${vendor}";
      in
      filterDirsAttrs (getAttrs [ relpath ] vendorDirs)
    )
  ] ++ optional (config.device == "bacon")
    # Bacon needs vendor/oppo in addition to vendor/oneplus
    # See https://github.com/danielfullmer/robotnix/issues/26
    (filterDirsAttrs (getAttrs [ "vendor/oppo" ] vendorDirs))
  );

  source.manifest.url = mkDefault "https://github.com/LineageOS/android.git";
  source.manifest.rev = mkDefault "refs/heads/${LineageOSRelease}";

  # Enable robotnix-built chromium / webview
  #  apps.chromium.enable = mkDefault true;
  #  webview.chromium.availableByDefault = mkDefault true;
  #  webview.chromium.enable = mkDefault true;

  # This is the prebuilt webview apk from LineageOS. Adding this here is only
  # for convenience if the end-user wants to set `webview.prebuilt.enable = true;`.
  #  webview.prebuilt.apk = config.source.dirs."external/chromium-webview".src + "/prebuilt/${config.arch}/webview.apk";
  #  webview.prebuilt.availableByDefault = mkDefault true;
  #  removedProductPackages = [ "webview" ];

  # Needed by included kernel build for some devices (pioneer at least)
  envPackages = [ pkgs.openssl.dev ] ++ optionals (config.androidVersion == 11) [ pkgs.gcc.cc pkgs.glibc.dev ];

  envVars.RELEASE_TYPE = mkDefault "EXPERIMENTAL"; # Other options are RELEASE NIGHTLY SNAPSHOT EXPERIMENTAL

  # LineageOS flattens all APEX packages: https://review.lineageos.org/c/LineageOS/android_vendor_lineage/+/270212
  signing.apex.enable = false;
  # This environment variable is set in android/build.sh under https://github.com/lineageos-infra/build-config
  envVars.OVERRIDE_TARGET_FLATTEN_APEX = "true";

  # LineageOS needs this additional command line argument to enable
  # backuptool.sh, which runs scripts under /system/addons.d
  otaArgs = [ "--backup=true" ];
}
19:23:10
@kranzes:matrix.orgkranzesis this correct?19:23:12
@danielrf:matrix.orgdanielrfThat looks OK to me. Something weird happened with formatting at lines 26-30 though19:24:15
@kranzes:matrix.orgkranzesnixpkgs-fmt might have bugged out19:24:43
@kranzes:matrix.orgkranzesnot sure19:24:45
@kranzes:matrix.orgkranzesAlso19:25:20
@kranzes:matrix.orgkranzeswhen running update.sh19:25:23
@kranzes:matrix.orgkranzeswill this also add new repos19:25:31
@kranzes:matrix.orgkranzesthat have been added to the manifest19:25:35
@kranzes:matrix.orgkranzesor just updated already available ones in the repo.json19:25:42
@danielrf:matrix.orgdanielrfNo, I believe you can return to adding the extra repos via your flake.nix. I doubt that was ever the problem.19:26:22
@kranzes:matrix.orgkranzesIt's not related to our issue19:26:46
@kranzes:matrix.orgkranzesim trying to understand if the mk_repo_file does that19:27:00
@kranzes:matrix.orgkranzesby default19:27:03
@kranzes:matrix.orgkranzeswhere it adds to the repo.json new stuff that havent been there before or just sync/update stuff that is there already19:27:33
@danielrf:matrix.orgdanielrfOh, sorry I misread.19:27:41
@danielrf:matrix.orgdanielrfYes, if the upstream adds a new <project> tag to the manifest then we'll have a new object in the JSON representing it19:27:58
@kranzes:matrix.orgkranzesAlright thanks19:28:08
@kranzes:matrix.orgkranzesalso what about reproducabilityfixed19:28:17
@kranzes:matrix.orgkranzes * also what about reproducabilityfixes19:28:18
@kranzes:matrix.orgkranzeswhat does it do?19:28:23
@kranzes:matrix.orgkranzescan that maybe cause an issue?19:28:27
@kranzes:matrix.orgkranzesthe mk-repo scripts takes ages then compilation for another 3 hours 🥱19:30:54
@danielrf:matrix.orgdanielrfPossibly it could cause the issue. It just applies some extra patches to fix some kernels and set consistent partition UUIDs19:31:21

Show newer messages


Back to Room ListRoom Version: 6