diff options
Diffstat (limited to 'krebs')
-rw-r--r-- | krebs/3modules/ci.nix | 8 | ||||
-rw-r--r-- | krebs/krops.nix | 36 |
2 files changed, 27 insertions, 17 deletions
diff --git a/krebs/3modules/ci.nix b/krebs/3modules/ci.nix index d8d0e7f3d..a47dbe611 100644 --- a/krebs/3modules/ci.nix +++ b/krebs/3modules/ci.nix @@ -27,14 +27,14 @@ let hostname = config.networking.hostName; getJobs = pkgs.writeDash "get_jobs" '' set -efu - nix-build --no-out-link --quiet -Q ./ci.nix > /dev/null - js="$(nix-instantiate --quiet -Q --eval --strict --json ./ci.nix)" - echo "$js" | jq -r 'to_entries[] | [.key, .value] | @tsv' \ + ${pkgs.nix}/bin/nix-build --no-out-link --quiet -Q ./ci.nix >&2 + json="$(${pkgs.nix}/bin/nix-instantiate --quiet -Q --eval --strict --json ./ci.nix)" + echo "$json" | ${pkgs.jq}/bin/jq -r 'to_entries[] | [.key, .value] | @tsv' \ | while read -r host builder; do gcroot=${shell.escape profileRoot}/$host-builder ${pkgs.nix}/bin/nix-env -p "$gcroot" --set "$builder" done - echo "$js" + echo "$json" ''; profileRoot = "/nix/var/nix/profiles/ci"; diff --git a/krebs/krops.nix b/krebs/krops.nix index 763e76b83..1058e73c0 100644 --- a/krebs/krops.nix +++ b/krebs/krops.nix @@ -7,11 +7,24 @@ # TODO document why pkgs should be used like this pkgs = import "${krops}/pkgs" {}; - krebs-source = { + krebs-nixpkgs = { test ? false }: if test then { + nixpkgs.file = { + path = toString (pkgs.fetchFromGitHub { + owner = "nixos"; + repo = "nixpkgs"; + rev = (lib.importJSON ./nixpkgs.json).rev; + sha256 = (lib.importJSON ./nixpkgs.json).sha256; + }); + useChecksum = true; + }; + } else { nixpkgs.git = { ref = (lib.importJSON ./nixpkgs.json).rev; url = https://github.com/NixOS/nixpkgs; }; + }; + + krebs-source = { stockholm.file = toString ../.; stockholm-version.pipe = toString (pkgs.writeDash "${name}-version" '' set -efu @@ -28,21 +41,18 @@ }; source ={ test }: lib.evalSource [ + (krebs-nixpkgs { test = test; }) krebs-source { nixos-config.symlink = "stockholm/krebs/1systems/${name}/config.nix"; - secrets = - if test - then { - file = toString <stockholm/krebs/0tests/data/secrets>; - } - else { - pass = { - dir = "${lib.getEnv "HOME"}/brain"; - name = "krebs-secrets/${name}"; - }; - } - ; + secrets = if test then { + file = toString <stockholm/krebs/0tests/data/secrets>; + } else { + pass = { + dir = "${lib.getEnv "HOME"}/brain"; + name = "krebs-secrets/${name}"; + }; + }; } ]; |