fix(gc-hosts): source nix-daemon profile on pve1 before running gc
Check NixOS configurations / eval-hosts (pull_request) Successful in 10m34s

BatchMode SSH sessions don't source /etc/profile on non-NixOS hosts, so
nix-collect-garbage isn't on PATH for the wayne user. Source the nix-daemon
profile script explicitly, matching the pattern in scripts/lib/nix-bootstrap.sh.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-07-29 13:45:48 +10:00
co-authored by Claude Sonnet 4.6
parent 629c1457a9
commit 0ef8259225
+5 -2
View File
@@ -121,7 +121,7 @@ if [[ "$DRY_RUN" -eq 1 ]]; then
echo " ssh ${SSH_OPTS[*]} $target 'sudo -n nix-collect-garbage -d'" echo " ssh ${SSH_OPTS[*]} $target 'sudo -n nix-collect-garbage -d'"
echo " # fallback: ssh ... $target 'nix-collect-garbage -d'" echo " # fallback: ssh ... $target 'nix-collect-garbage -d'"
else else
echo " ssh ${SSH_OPTS[*]} $target 'nix-collect-garbage -d'" echo " ssh ${SSH_OPTS[*]} $target '. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && nix-collect-garbage -d'"
fi fi
done done
exit 0 exit 0
@@ -147,7 +147,10 @@ gc_one() {
echo "ok(user)"; return echo "ok(user)"; return
fi fi
else else
if ssh "${SSH_OPTS[@]}" "$target" "nix-collect-garbage -d" \ # Non-NixOS node: BatchMode SSH doesn't source the Nix daemon profile, so
# nix-collect-garbage won't be on PATH unless we source it explicitly.
local nix_profile='. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh 2>/dev/null || true'
if ssh "${SSH_OPTS[@]}" "$target" "$nix_profile && nix-collect-garbage -d" \
>>"$logfile" 2>>"$logfile"; then >>"$logfile" 2>>"$logfile"; then
echo "ok"; return echo "ok"; return
fi fi