Remote deploy using nixos-rebuild rather than "nix shell"

This commit is contained in:
Ehmry - 2021-02-22 13:42:42 +01:00
parent ec81b6a28d
commit ad5d1b6967
1 changed files with 3 additions and 4 deletions

View File

@ -32,16 +32,15 @@
#!${pkgs.runtimeShell}
set -ev
nix-copy-closure --to ${target} ${self}
exec ssh -t ${target} \
nix shell \
${self}#nixosConfigurations.${name}.config.system.build.toplevel \
--command switch-to-configuration $@
exec ssh -t ${target} nixos-rebuild --flake ${self}#${name} $@
'';
mkWake = name:
pkgs.writeScriptBin "${name}-wake" ''
#!${pkgs.runtimeShell}
exec ${pkgs.wol}/bin/wol ${hostRegistry.hosts.${name}.ether}
'';
# TODO: check if the ethernet address is reachable and if not,
# execute wol on a machine in HQ.
in {
glotzbert-nixos-rebuild = mkDeploy "glotzbert" "glotzbert.hq.c3d2.de";
glotzbert-wake = mkWake "glotzbert";