1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00
Files
niveum/deploy.nix
2021-12-29 17:41:53 +01:00

39 lines
1.2 KiB
Nix

let
inherit (import ./lib/default.nix) sshPort;
krops = builtins.fetchGit { url = "https://cgit.krebsco.de/krops/"; };
lib = import "${krops}/lib";
pkgs = import "${krops}/pkgs" { };
source = name: lib.evalSource [{
niveum.file = toString ./.;
system-secrets.pass = {
dir = toString ~/.password-store;
name = "systems/${name}";
};
secrets.pass = {
dir = toString ~/.password-store;
name = "shared";
};
}];
command = targetPath: ''
nix-shell -p git --run '
nixos-rebuild switch -v --show-trace --flake ${targetPath}/niveum || \
nixos-rebuild switch -v --flake ${targetPath}/niveum
'
'';
createHost = name: target: pkgs.krops.writeCommand "deploy-${name}" {
source = source name;
inherit command target;
};
in rec {
zaatar = createHost "zaatar" "root@zaatar.r:${toString sshPort}";
kabsa = createHost "kabsa" "root@kabsa.r:${toString sshPort}";
makanek = createHost "kabsa" "root@makanek.r:${toString sshPort}";
manakish = createHost "kabsa" "root@manakish.r:${toString sshPort}";
all = pkgs.writeScript "deploy-all"
(lib.concatStringsSep "\n" [ zaatar kabsa makanek manakish ]);
}