diff --git a/flake.nix b/flake.nix index 23b9497d..9a053f14 100644 --- a/flake.nix +++ b/flake.nix @@ -136,22 +136,23 @@ # Can be run with `nix run c3d2#…-nixos-rebuild switch` "${name}-nixos-rebuild" = pkgs.writeScriptBin "${name}-nixos-rebuild" '' #!${pkgs.runtimeShell} -e + [[ $(ssh ${target} cat /etc/hostname) == ${name} ]] nix copy --to ssh://${target} ${secrets} nix copy --to ssh://${target} ${self} - exec ssh ${target} nixos-rebuild ${rebuildArg} $@ + ssh ${target} nixos-rebuild ${rebuildArg} "$@" ''; "${name}-nixos-rebuild-local" = pkgs.writeScriptBin "${name}-nixos-rebuild" '' - #!${pkgs.runtimeShell} -e - set -x - nix copy --to ssh://${target} ${profile} - exec ssh ${target} "${profile}/bin/switch-to-configuration $@" - ''; + #!${pkgs.runtimeShell} -e + [[ $(ssh ${target} cat /etc/hostname) == ${name} ]] + nix copy --to ssh://${target} ${profile} + ssh ${target} "${profile}/bin/switch-to-configuration $*" + ''; "${name}-cleanup" = pkgs.writeScriptBin "${name}-cleanup" '' - #!${pkgs.runtimeShell} -e - exec ssh ${target} "time nix-collect-garbage -d && time nix-store --optimise" - ''; + #!${pkgs.runtimeShell} -e + ssh ${target} "time nix-collect-garbage -d && time nix-store --optimise" + ''; }) {} (builtins.attrNames flakifiedHosts) // builtins.foldl' (result: host: result // {