Skip to content

Commit

Permalink
source: giant refactor to just use json files directly
Browse files Browse the repository at this point in the history
  • Loading branch information
danielfullmer committed Mar 18, 2020
1 parent e814583 commit 96f5ef5
Show file tree
Hide file tree
Showing 26 changed files with 213 additions and 1,644 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,22 @@ This would allow an end-user to simply sign their own releases without building
As of Android 10, `target-files` seem to be built reproducibly.
Further tests are needed for `img`/`ota` files.


### Fetching android source files

RobotNix supports two alternative approaches for fetching source files:

- Build-time source fetching with `pkgs.fetchgit`. This is the default.
The end user will need to create a repo json file using `mk-repo-file.py` and update `source.jsonFile` to point to this file.
- Evaluation-time source fetching with `builtins.fetchGit`.
This is more convenient for development when changing branches, as it allows use of a shared git cache.
The end user will need to set `source.manifest.{url,rev,sha256}` and enable `source.evalTimeFetching`.
However, with `builtins.fetchGit`, the `drv`s themselves depend on the source,
and `nix-copy-closure` of even just the `.drv` files would require downloading the source as well.

### Additional information


Optional CCACHE stuff.
As root:
```console
Expand Down
14 changes: 7 additions & 7 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ in
}
configuration
./flavors/common.nix
./flavors/grapheneos.nix
./flavors/pixel.nix
./flavors/vanilla.nix
./flavors/grapheneos
./flavors/pixel
./flavors/vanilla
./modules/apps/auditor.nix
./modules/apps/fdroid.nix
./modules/apps/chromium.nix
./modules/apps/fdroid.nix
./modules/apps/prebuilt.nix
./modules/apps/seedvault.nix
./modules/apps/updater.nix
Expand All @@ -33,11 +33,11 @@ in
./modules/kernel.nix
./modules/keys.nix
./modules/microg.nix
./modules/prebuilts.nix
./modules/release.nix
./modules/resources.nix
./modules/source
./modules/source/prebuilts.nix
./modules/webview.nix
./modules/source.nix
./modules/vendor.nix
./modules/webview.nix
];
}).config
60 changes: 29 additions & 31 deletions flavors/common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ let
in
mkMerge [
{
source.hashes = importJSON ./hashes.json;

# Some android version-specific fixes:
source.dirs."prebuilts/misc".postPatch = mkIf (config.androidVersion == 9) "ln -sf ${flex}/bin/flex linux-x86/flex/flex-2.5.39";
source.dirs."build/make".patches = mkIf (config.androidVersion == 10) [
Expand All @@ -32,33 +30,33 @@ mkMerge [
apex.enable = mkIf (config.androidVersion >= 10) (mkDefault true);
}
{
# Disable some unused directories to save time downloading / extracting
source.dirs = listToAttrs (map (dir: nameValuePair dir { enable = false; })
[ "developers/samples/android"
"developers/demos"

"device/generic/car"
# "device/generic/qemu"
# "prebuilts/qemu-kernel"
"prebuilts/android-emulator"

"device/linaro/bootloader/arm-trusted-firmware"
"device/linaro/bootloader/edk2"
"device/linaro/bootloader/OpenPlatformPkg"
"device/linaro/hikey"
"device/linaro/hikey-kernel"
"device/linaro"

"device/generic/mini-emulator-arm64"
"device/generic/mini-emulator-armv7-a-neon"
"device/generic/mini-emulator-mips"
"device/generic/mini-emulator-mips64"
"device/generic/mini-emulator-x86"
"device/generic/mini-emulator-x86_64"
"device/generic/mips"
"device/generic/mips64"
"device/google/accessory/arduino"
"device/google/accessory/demokit"
"device/google/atv"
]);
# # Disable some unused directories to save time downloading / extracting
# source.dirs = listToAttrs (map (dir: nameValuePair dir { enable = false; })
# [ "developers/samples/android"
# "developers/demos"
#
# "device/generic/car"
## "device/generic/qemu"
## "prebuilts/qemu-kernel"
# "prebuilts/android-emulator"
#
# "device/linaro/bootloader/arm-trusted-firmware"
# "device/linaro/bootloader/edk2"
# "device/linaro/bootloader/OpenPlatformPkg"
# "device/linaro/hikey"
# "device/linaro/hikey-kernel"
# "device/linaro"
#
# "device/generic/mini-emulator-arm64"
# "device/generic/mini-emulator-armv7-a-neon"
# "device/generic/mini-emulator-mips"
# "device/generic/mini-emulator-mips64"
# "device/generic/mini-emulator-x86"
# "device/generic/mini-emulator-x86_64"
# "device/generic/mips"
# "device/generic/mips64"
# "device/google/accessory/arduino"
# "device/google/accessory/demokit"
# "device/google/atv"
# ]);
}]
1 change: 1 addition & 0 deletions flavors/grapheneos/QQ2A.200305.002.2020.03.04.16.json

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions flavors/grapheneos.nix → flavors/grapheneos/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,27 @@ let
sailfish = "marlin";
sargo = "bonito";
};
grapheneOSRelease = "2020.03.04.16";
grapheneOSRelease = "${config.source.buildNumber}.2020.03.04.16";
in mkIf (config.flavor == "grapheneos") (mkMerge [
(mkIf ((elem config.deviceFamily [ "taimen" "crosshatch" "bonito" ]) || (config.device == "x86")) {
source.buildNumber = "QQ2A.200305.002";
source.manifest.sha256 = "1s2y87rzg2lcrqfx9gkjkz4aaazn9k4s0pk4lgwki7mpsh2pp3c0";
})
(mkIf (elem config.deviceFamily [ "crosshatch" "bonito" ]) {
# Hack for crosshatch/bonito since they uses submodules and repo2nix doesn't support that yet.
kernel.src = pkgs.fetchFromGitHub {
owner = "GrapheneOS";
repo = "kernel_google_crosshatch";
rev = "${config.source.buildNumber}.${grapheneOSRelease}";
rev = grapheneOSRelease;
sha256 = "08dc9q4bldli85zp0lwc2jqhpqwxclkqg030iq7qm7ygqckb22kh";
fetchSubmodules = true;
};
})
{
source.jsonFile = ./. + "/${grapheneOSRelease}.json";

# Not strictly necessary for me to set these, since I override the jsonFile
source.manifest.url = "https://github.com/GrapheneOS/platform_manifest.git";
source.manifest.rev = "refs/tags/${config.source.buildNumber}.${grapheneOSRelease}";
source.manifest.rev = "refs/tags/${grapheneOSRelease}";

# Hack for crosshatch/bonito since they use submodules and repo2nix doesn't support that yet.
kernel.useCustom = mkDefault true;
Expand Down
4 changes: 4 additions & 0 deletions flavors/grapheneos/update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

export TMPDIR=/tmp
../../mk-repo-file.py --mirror "/mnt/media/mirror" "https://github.com/GrapheneOS/platform_manifest" "$1" *.json ../vanilla/*.json
Loading

0 comments on commit 96f5ef5

Please sign in to comment.