diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-07-18 13:56:22 +0200 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-07-18 13:56:22 +0200 |
| commit | 95fb70056cd5c6479961271707e66a4f1305223e (patch) | |
| tree | 2b8336355a53cbd83264de36498c537ebfe26c82 | |
| parent | scripts/update_hosts.remote: Use the default `nixos-rebuild` (diff) | |
| download | nixos-server-95fb70056cd5c6479961271707e66a4f1305223e.zip | |
scripts/update_hosts.sh: Use faster `nix copy` and ping hosts after update
| -rwxr-xr-x | scripts/update_hosts.sh | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/scripts/update_hosts.sh b/scripts/update_hosts.sh index 505f061..cc459ed 100755 --- a/scripts/update_hosts.sh +++ b/scripts/update_hosts.sh @@ -10,10 +10,8 @@ branch="${3-main}" for host in $hosts; do echo "Updating '$user@$host.vhack.eu' ..." - new_system="$(nix build ".#nixosConfigurations.$host.config.system.build.toplevel" --no-link --print-out-paths)" - printf "Copying closure ..\n" - nix-copy-closure "$user@$host.vhack.eu" "$new_system" + nix copy --substitute-on-destination --to "ssh://$user@$host.vhack.eu" ".#nixosConfigurations.$host.config.system.build.toplevel" printf "Deploying remote side script ..\n" scp "$base_dir/scripts/update_hosts.remote" "$user@$host.vhack.eu:update_host.remote" @@ -21,4 +19,9 @@ for host in $hosts; do printf "Executing remote side script ..\n" ssh -t "$user@$host.vhack.eu" "chmod +x update_host.remote; ./update_host.remote '$branch'" done + +# Give the servers some time to reboot +sleep 5 +ping_hosts.sh + # vim: ft=sh |
