infrastructure/krops.nix

35 lines
1.2 KiB
Nix
Raw Normal View History

let
krops = builtins.fetchGit { url = "https://cgit.krebsco.de/krops/"; };
lib = import "${krops}/lib";
pkgs = import "${krops}/pkgs" { };
source = machine:
lib.evalSource [{
config.file = toString ./machines;
nixos-config.symlink = "config/${machine}/configuration.nix";
nixpkgs.git = {
clean.exclude = [ "/.version-suffix" ];
ref = "973910f5c31b9ba6c171c33a8bd7199990b14c72"; # nixos-21.05
url = "https://github.com/NixOS/nixpkgs";
};
}];
mkTestConfig = hostname: {
name = "test-${hostname}";
value = pkgs.krops.writeTest "test-${hostname}" {
source = source hostname;
2021-07-26 03:56:37 +02:00
target = lib.mkTarget {
host = "localhost";
path = "/tmp/src";
};
force = true; # force create the sentinel file.
2021-07-26 03:14:23 +02:00
};
};
mkTestsConfig = hostnames: builtins.listToAttrs (map mkTestConfig hostnames);
mkDeploy = hostname: target: { ${hostname} = pkgs.krops.writeDeploy "deploy-${hostname}" {
source = source hostname;
inherit target;
2021-07-29 00:09:32 +02:00
}; };
in {}
// mkDeploy "core-services-01" "root@core01.internal.rz.ens.wtf"
// mkDeploy "remote-builder-01" "root@nix01.builders.rz.ens.wtf"
// mkTestsConfig [ "core-services-01" "remote-builder-01" ]