Skip to content

Commit 86d6c9f

Browse files
committed
twrp: Prepare for multiple branches
1 parent 0294b7f commit 86d6c9f

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

flavors/twrp/default.nix

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@ let
99
mkIf
1010
mkMerge
1111
;
12-
TWRPBranch = "twrp-9.0";
12+
androidVersionToTWRPBranch = {
13+
"9" = "twrp-9.0";
14+
};
15+
TWRPBranch = androidVersionToTWRPBranch.${toString config.androidVersion};
1316
repoDirs = lib.importJSON (./. + "/${TWRPBranch}/repo.json");
1417
in mkIf (config.flavor == "twrp")
18+
(mkMerge [
1519
{
16-
androidVersion = mkDefault 9;
20+
# Defaults elsewhere makes it default to `12` if unset.
21+
androidVersion = mkDefault (builtins.throw "androidVersion needs to be set according to your device tree.");
1722

1823
# product names start with "omni_"
1924
# → lunch omni_sailfish-eng
@@ -26,18 +31,6 @@ in mkIf (config.flavor == "twrp")
2631

2732
source.dirs = mkMerge ([
2833
repoDirs
29-
{
30-
"bootable/recovery" = {
31-
patches = [
32-
./patches/android_bootable_recovery/0001-gui-Don-t-preserve-mode-owner-when-copying-files.patch
33-
];
34-
};
35-
"build/make" = {
36-
patches = [
37-
./patches/android_build/0001-Work-around-source-files-being-read-only.patch
38-
];
39-
};
40-
}
4134
]);
4235

4336
source.manifest.url = mkDefault "https://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni.git";
@@ -56,3 +49,20 @@ in mkIf (config.flavor == "twrp")
5649
};
5750
};
5851
}
52+
(mkIf (config.androidVersion == 9) {
53+
source.dirs = mkMerge ([
54+
repoDirs
55+
{
56+
"bootable/recovery" = {
57+
patches = [
58+
./patches/android_bootable_recovery/0001-gui-Don-t-preserve-mode-owner-when-copying-files.patch
59+
];
60+
};
61+
"build/make" = {
62+
patches = [
63+
./patches/android_build/0001-Work-around-source-files-being-read-only.patch
64+
];
65+
};
66+
}
67+
]);
68+
})

0 commit comments

Comments
 (0)