n: add krops.nix

This commit is contained in:
lassulus 2018-09-08 12:31:56 +02:00
parent 288db486ee
commit 68bf23466f
1 changed files with 40 additions and 0 deletions

40
nin/krops.nix Normal file
View File

@ -0,0 +1,40 @@
{ name }: let
inherit (import ../krebs/krops.nix { inherit name; })
krebs-source
lib
pkgs
;
source = { test }: lib.evalSource [
krebs-source
{
nixos-config.symlink = "stockholm/nin/1systems/${name}/config.nix";
secrets = if test then {
file = toString ./0tests/dummysecrets;
} else {
pass = {
dir = "${lib.getEnv "HOME"}/.password-store";
name = "hosts/${name}";
};
};
}
];
in {
# usage: $(nix-build --no-out-link --argstr name HOSTNAME -A deploy)
deploy = pkgs.krops.writeDeploy "${name}-deploy" {
source = source { test = false; };
target = "root@${name}/var/src";
};
# usage: $(nix-build --no-out-link --argstr name HOSTNAME -A test)
test = pkgs.krops.writeTest "${name}-test" {
source = source { test = true; };
target = "${lib.getEnv "HOME"}/tmp/${name}-stockholm-test";
};
ci = pkgs.krops.writeTest "${name}-test" {
source = source { test = true; };
target = "${lib.getEnv "HOME"}/stockholm-build";
};
}