From df2549e712edea4d46aa4132d3a481a4ad0b273e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Wed, 27 Oct 2021 21:25:00 +0200 Subject: [PATCH] flake.nix: format, remove exec, check if hostname is correct --- flake.nix | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) 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 // {