flake.nix: format, remove exec, check if hostname is correct
This commit is contained in:
parent
1460fa8131
commit
df2549e712
|
@ -136,21 +136,22 @@
|
||||||
# Can be run with `nix run c3d2#…-nixos-rebuild switch`
|
# Can be run with `nix run c3d2#…-nixos-rebuild switch`
|
||||||
"${name}-nixos-rebuild" = pkgs.writeScriptBin "${name}-nixos-rebuild" ''
|
"${name}-nixos-rebuild" = pkgs.writeScriptBin "${name}-nixos-rebuild" ''
|
||||||
#!${pkgs.runtimeShell} -e
|
#!${pkgs.runtimeShell} -e
|
||||||
|
[[ $(ssh ${target} cat /etc/hostname) == ${name} ]]
|
||||||
nix copy --to ssh://${target} ${secrets}
|
nix copy --to ssh://${target} ${secrets}
|
||||||
nix copy --to ssh://${target} ${self}
|
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" ''
|
"${name}-nixos-rebuild-local" = pkgs.writeScriptBin "${name}-nixos-rebuild" ''
|
||||||
#!${pkgs.runtimeShell} -e
|
#!${pkgs.runtimeShell} -e
|
||||||
set -x
|
[[ $(ssh ${target} cat /etc/hostname) == ${name} ]]
|
||||||
nix copy --to ssh://${target} ${profile}
|
nix copy --to ssh://${target} ${profile}
|
||||||
exec ssh ${target} "${profile}/bin/switch-to-configuration $@"
|
ssh ${target} "${profile}/bin/switch-to-configuration $*"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
"${name}-cleanup" = pkgs.writeScriptBin "${name}-cleanup" ''
|
"${name}-cleanup" = pkgs.writeScriptBin "${name}-cleanup" ''
|
||||||
#!${pkgs.runtimeShell} -e
|
#!${pkgs.runtimeShell} -e
|
||||||
exec ssh ${target} "time nix-collect-garbage -d && time nix-store --optimise"
|
ssh ${target} "time nix-collect-garbage -d && time nix-store --optimise"
|
||||||
'';
|
'';
|
||||||
}) {} (builtins.attrNames flakifiedHosts) //
|
}) {} (builtins.attrNames flakifiedHosts) //
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue