2018-09-07 15:55:22 +00:00
|
|
|
{ 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
|
|
|
|
;
|
|
|
|
|
2018-11-21 03:58:55 +00:00
|
|
|
host-source = if lib.pathExists (./. + "/1systems/${name}/source.nix") then
|
|
|
|
import (./. + "/1systems/${name}/source.nix") { inherit lib pkgs; }
|
|
|
|
else
|
|
|
|
{}
|
|
|
|
;
|
|
|
|
|
2018-04-05 17:31:39 +00:00
|
|
|
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 {
|
2018-09-07 14:55:37 +00:00
|
|
|
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}";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
2018-11-21 03:58:55 +00:00
|
|
|
host-source
|
2018-04-05 17:31:39 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
in {
|
2018-11-20 00:16:22 +00:00
|
|
|
|
2018-04-05 17:31:39 +00:00
|
|
|
# usage: $(nix-build --no-out-link --argstr name HOSTNAME -A deploy)
|
2018-10-23 13:45:38 +00:00
|
|
|
deploy = { target ? "root@${name}/var/src" }: pkgs.krops.writeDeploy "${name}-deploy" {
|
2018-04-05 17:31:39 +00:00
|
|
|
source = source { test = false; };
|
2018-10-23 13:45:38 +00:00
|
|
|
inherit target;
|
2018-04-05 17:31:39 +00:00
|
|
|
};
|
|
|
|
|
2018-11-20 00:16:22 +00:00
|
|
|
# usage: $(nix-build --no-out-link --argstr name HOSTNAME --argstr target PATH -A populate)
|
|
|
|
populate = { target, force ? false }: pkgs.populate {
|
|
|
|
inherit force;
|
|
|
|
source = source { test = false; };
|
|
|
|
target = lib.mkTarget target;
|
|
|
|
};
|
|
|
|
|
2018-09-09 08:23:20 +00:00
|
|
|
# usage: $(nix-build --no-out-link --argstr name HOSTNAME --argstr target PATH -A test)
|
|
|
|
test = { target }: pkgs.krops.writeTest "${name}-test" {
|
2018-10-09 11:48:52 +00:00
|
|
|
force = true;
|
2018-09-09 08:23:20 +00:00
|
|
|
inherit target;
|
2018-04-05 17:31:39 +00:00
|
|
|
source = source { test = true; };
|
2018-09-07 15:40:10 +00:00
|
|
|
};
|
2018-04-05 17:31:39 +00:00
|
|
|
}
|