flake.nix: implement --flakify switch for converting hosts to flakes

This commit is contained in:
Astro 2021-03-05 01:26:19 +01:00
parent d89788511a
commit d6ca053da1
1 changed files with 6 additions and 1 deletions

View File

@ -35,7 +35,12 @@
set -ev
nix-copy-closure --to ${target} ${secrets}
nix-copy-closure --to ${target} ${self}
exec ssh -t ${target} nixos-rebuild --flake ${self}#${name} $@
if [ "$1" = "--flakify" ]; then
shift
exec ssh -t ${target} "nix-shell -p nixFlakes --command \"_NIXOS_REBUILD_REEXEC=1 nixos-rebuild --flake ${self}#${name} \"$@"
else
exec ssh -t ${target} nixos-rebuild --flake ${self}#${name} $@
fi
'';
mkWake = name:
pkgs.writeScriptBin "${name}-wake" ''