-
Notifications
You must be signed in to change notification settings - Fork 70
/
release.nix
76 lines (61 loc) · 2.62 KB
/
release.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# SPDX-FileCopyrightText: 2021 Daniel Fullmer and robotnix contributors
# SPDX-License-Identifier: MIT
{ pkgs ? (import ./pkgs {}) }:
let
lib = pkgs.lib;
robotnix = configuration: import ./default.nix { inherit configuration pkgs; };
configs = import ./configs.nix { inherit lib; };
builtConfigs = lib.mapAttrs (name: c: robotnix c) configs;
defaultBuild = robotnix { device="arm64"; flavor="vanilla"; };
tests = {
attestation-server = (import ./nixos/attestation-server/test.nix { inherit pkgs; }) {};
generateKeys = let
inherit ((robotnix { device="crosshatch"; flavor="vanilla"; }))
generateKeysScript verifyKeysScript;
in pkgs.runCommand "test-generate-keys" { nativeBuildInputs = [ pkgs.shellcheck ]; } ''
mkdir -p $out
cd $out
shellcheck ${generateKeysScript}
shellcheck ${verifyKeysScript}
${verifyKeysScript} $PWD && exit 1 || true # verifyKeysScript should fail if we haven't generated keys yet
${generateKeysScript} $PWD
${verifyKeysScript} $PWD
'';
};
in {
inherit (pkgs) diffoscope;
imgs = lib.recurseIntoAttrs (lib.mapAttrs (name: c: c.img) builtConfigs);
# For testing instantiation
vanilla-arm64 = lib.recurseIntoAttrs {
inherit (defaultBuild)
ota img factoryImg bootImg otaDir
releaseScript;
};
sdk = import ./sdk;
grapheneos-emulator = (robotnix { device="x86_64"; flavor="grapheneos"; }).emulator;
vanilla-emulator = (robotnix { device="x86_64"; flavor="vanilla"; }).emulator;
vanilla-12-emulator = (robotnix { device="x86_64"; flavor="vanilla"; productNamePrefix="sdk_phone_"; androidVersion=12; }).emulator;
danielfullmer-emulator = (robotnix { device="x86_64"; flavor="grapheneos"; imports = [ ./example.nix ]; apps.auditor.enable = lib.mkForce false; }).emulator;
inherit tests;
# Stuff to upload to binary cache
cached = lib.recurseIntoAttrs {
browsers = lib.recurseIntoAttrs {
inherit ((robotnix { device = "arm64"; flavor="vanilla"; }).config.build)
chromium;
inherit ((robotnix { device = "arm64"; flavor="vanilla"; apps.bromite.enable=true; webview.bromite.enable=true; }).config.build)
bromite;
inherit ((robotnix { device = "arm64"; flavor="grapheneos"; }).config.build)
vanadium;
};
kernels = lib.recurseIntoAttrs (
(lib.mapAttrs (name: c: c.config.build.kernel)
(lib.filterAttrs (name: c: c.config.kernel.enable) builtConfigs)));
tests = lib.recurseIntoAttrs {
attestation-server = tests.attestation-server.test;
inherit (tests) generateKeys;
};
packages = lib.recurseIntoAttrs {
inherit (pkgs) cipd;
};
};
}