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} #!${pkgs.runtimeShell}
set -ev set -ev
nix-copy-closure --to ${target} ${self} nix-copy-closure --to ${target} ${self}
exec ssh -t ${target} \ exec ssh -t ${target} nixos-rebuild --flake ${self}#${name} $@
nix shell \
${self}#nixosConfigurations.${name}.config.system.build.toplevel \
--command switch-to-configuration $@
''; '';
mkWake = name: mkWake = name:
pkgs.writeScriptBin "${name}-wake" '' pkgs.writeScriptBin "${name}-wake" ''
#!${pkgs.runtimeShell} #!${pkgs.runtimeShell}
exec ${pkgs.wol}/bin/wol ${hostRegistry.hosts.${name}.ether} 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 { in {
glotzbert-nixos-rebuild = mkDeploy "glotzbert" "glotzbert.hq.c3d2.de"; glotzbert-nixos-rebuild = mkDeploy "glotzbert" "glotzbert.hq.c3d2.de";
glotzbert-wake = mkWake "glotzbert"; glotzbert-wake = mkWake "glotzbert";