stockholm/lass/krops.nix

43 lines
1.2 KiB
Nix
Raw Normal View History

{ config ? config, name }: let
2018-06-07 06:24:56 +00:00
inherit (import ../krebs/krops.nix { inherit name; })
2018-04-05 17:31:39 +00:00
krebs-source
lib
pkgs
;
source = { test }: lib.evalSource [
krebs-source
{
2018-05-12 13:53:04 +00:00
nixos-config.symlink = "stockholm/lass/1systems/${name}/physical.nix";
2018-04-05 17:31:39 +00:00
secrets = if test then {
file = toString ./2configs/tests/dummy-secrets;
2018-04-05 17:31:39 +00:00
} else {
pass = {
dir = "${lib.getEnv "HOME"}/.password-store";
name = "hosts/${name}";
};
};
}
];
in {
# usage: $(nix-build --no-out-link --argstr name HOSTNAME -A deploy)
2018-06-07 06:24:56 +00:00
deploy = pkgs.krops.writeDeploy "${name}-deploy" {
2018-04-05 17:31:39 +00:00
source = source { test = false; };
target = "root@${name}/var/src";
2018-04-05 17:31:39 +00:00
};
# usage: $(nix-build --no-out-link --argstr name HOSTNAME -A test)
test = pkgs.krops.writeTest "${name}-test" {
2018-04-05 17:31:39 +00:00
source = source { test = true; };
target = "${lib.getEnv "HOME"}/tmp/${name}-krops-test-src";
2018-04-05 17:31:39 +00:00
};
ci = map (host:
pkgs.krops.writeTest "${host.name}-test" {
source = source { test = true; };
target = "${lib.getEnv "TMPDIR"}/lass/${host.name}";
}
) (lib.filter (host: lib.getAttr "ci" host && host.owner == "lass") (lib.attrValues config.krebs.hosts));
2018-04-05 17:31:39 +00:00
}