2021-12-29 15:15:02 +01:00
|
|
|
{ pkgs, secrets, writeCommand, lib, nixosRebuildCommand ? "switch" }:
|
2019-01-31 23:39:38 +01:00
|
|
|
let
|
2021-12-29 15:15:02 +01:00
|
|
|
sshPort = 22022;
|
2020-10-28 21:43:33 +01:00
|
|
|
|
2021-12-29 15:15:02 +01:00
|
|
|
# command that ensures we use flake.nix during switch
|
|
|
|
|
command = targetPath:
|
|
|
|
|
let
|
|
|
|
|
commandLine = "TMPDIR=/tmp nixos-rebuild ${nixosRebuildCommand} --flake ${targetPath} -L --keep-going";
|
|
|
|
|
in
|
|
|
|
|
''
|
|
|
|
|
echo '${commandLine}'
|
|
|
|
|
nix-shell \
|
|
|
|
|
-E "with import <nixpkgs> {}; mkShell { buildInputs = [ git (nixos { nix.package = nixFlakes; }).nixos-rebuild ]; }" \
|
|
|
|
|
--run '${commandLine}'
|
|
|
|
|
'';
|
2019-01-31 23:39:38 +01:00
|
|
|
|
2021-12-29 15:15:02 +01:00
|
|
|
source = name: {
|
|
|
|
|
niveum.file = toString ./.;
|
|
|
|
|
system-secrets.pass = {
|
|
|
|
|
dir = secrets;
|
|
|
|
|
name = "systems/${name}";
|
|
|
|
|
};
|
|
|
|
|
secrets.pass = {
|
|
|
|
|
dir = secrets;
|
|
|
|
|
name = "shared";
|
|
|
|
|
};
|
|
|
|
|
};
|
2019-10-26 13:43:30 +02:00
|
|
|
|
2021-12-29 15:15:02 +01:00
|
|
|
deploy = {name, host}: writeCommand "/bin/system" {
|
|
|
|
|
source = lib.evalSource [ (source name) ];
|
|
|
|
|
force = true;
|
|
|
|
|
target = lib.mkTarget "root@${host}:${toString sshPort}/var/krops/niveum";
|
|
|
|
|
inherit command;
|
2019-04-10 21:14:29 +02:00
|
|
|
};
|
2019-06-17 18:01:14 +02:00
|
|
|
in {
|
2021-12-29 15:15:02 +01:00
|
|
|
zaatar = deploy { name = "zaatar"; host = "zaatar.r"; };
|
|
|
|
|
kabsa = deploy { name = "kabsa"; host = "kabsa.r"; };
|
|
|
|
|
manakish = deploy { name = "manakish"; host = "manakish.r"; };
|
|
|
|
|
makanek = deploy { name = "makanek"; host = "makanek.r"; };
|
2019-01-31 23:39:38 +01:00
|
|
|
}
|