summaryrefslogtreecommitdiffstats
path: root/configs/hrm-ci.nix
blob: b96126289d681daabd6acf183341ce0b983630c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# hrm.ci instance for hrm itself: builds every host whose
# systems/HOSTNAME/spec.nix has `ci = true;`.
#
# krops.nix finds everything except hrm through $HOME, so the importing host
# provides the rest with hrm.ci.instances.hrm.dependencies and .home, e.g.
#   dependencies."sync/src/krops".repo = "/var/lib/git/krops";
#   dependencies."sync/src/stockholm".repo = "/var/lib/git/stockholm";
{ config, lib, ... }: {
  hrm.ci.instances.hrm = {
    repo = lib.mkDefault "${config.krebs.git.dataDir}/hrm";
    jobs = /* sh */ ''
      set -efu
      hosts=$(nix-instantiate --eval --strict --json --expr '
        builtins.filter
          (name: (import (./systems + "/''${name}/spec.nix")).ci or false)
          (builtins.attrNames (builtins.readDir ./systems))
      ')
      echo "$hosts" | jq -r '.[]'
    '';
    build = /* sh */ ''
      nix-build krops.nix --no-out-link --argstr name "$1" -A build
    '';
  };
}