| 5 Sep 2021 |
samueldr | --arg already requires arguments to be named and present in the attrset pattern argument | 19:18:04 |
samueldr | so it would make sense to have it apply until it can't in deeper nested function calls? | 19:18:45 |
kranzes | 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 | 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 | See last section of https://docs.robotnix.org/modules/source.html | 19:22:36 |
kranzes | I'm not exactly sure what i need to comment out again | 19:22:55 |
kranzes | # 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 | is this correct? | 19:23:12 |
danielrf | That looks OK to me. Something weird happened with formatting at lines 26-30 though | 19:24:15 |
kranzes | nixpkgs-fmt might have bugged out | 19:24:43 |
kranzes | not sure | 19:24:45 |
kranzes | Also | 19:25:20 |
kranzes | when running update.sh | 19:25:23 |
kranzes | will this also add new repos | 19:25:31 |
kranzes | that have been added to the manifest | 19:25:35 |
kranzes | or just updated already available ones in the repo.json | 19:25:42 |
danielrf | No, 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 | It's not related to our issue | 19:26:46 |
kranzes | im trying to understand if the mk_repo_file does that | 19:27:00 |
kranzes | by default | 19:27:03 |
kranzes | where it adds to the repo.json new stuff that havent been there before or just sync/update stuff that is there already | 19:27:33 |
danielrf | Oh, sorry I misread. | 19:27:41 |
danielrf | Yes, if the upstream adds a new <project> tag to the manifest then we'll have a new object in the JSON representing it | 19:27:58 |
kranzes | Alright thanks | 19:28:08 |
kranzes | also what about reproducabilityfixed | 19:28:17 |
kranzes | * also what about reproducabilityfixes | 19:28:18 |
kranzes | what does it do? | 19:28:23 |
kranzes | can that maybe cause an issue? | 19:28:27 |
kranzes | the mk-repo scripts takes ages then compilation for another 3 hours 🥱 | 19:30:54 |
danielrf | Possibly it could cause the issue. It just applies some extra patches to fix some kernels and set consistent partition UUIDs | 19:31:21 |