summaryrefslogtreecommitdiffstats
path: root/ci.nix
blob: 7f50cbede67cc85b5b36225bd9c7f4e1b4a2d7ef (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
25
26
27
28
# usage: nix-instantiate --eval --json --read-write-mode --strict ci.nix | jq .
with import ./lib;
let
  pkgs = import <nixpkgs> { overlays = [ (import ./submodules/nix-writers/pkgs) ]; };
  system =
    import <nixpkgs/nixos/lib/eval-config.nix> {
      modules = [{
        imports = [
          ./krebs
          ./krebs/2configs
        ];
      }];
    }
  ;

  ci-systems = filterAttrs (_: v: v.ci) system.config.krebs.hosts;

  build = host: owner: let
    target = "${getEnv "HOME"}/stockholm-build";
    krops-file = toString ./. + "/${owner}/krops.nix";
  in pkgs.writeDash "build-${owner}-${host}" ''
    #do not use stockholm from system
    export NIX_PATH=stockholm="${toString ./.}":"$NIX_PATH"

    ${((import krops-file { name = host; }).test { target = target; })}
  '';

in mapAttrs (n: h: build n h.owner.name) ci-systems