deploy: gc jupiter after every switch (eMMC space)

configurationLimit prunes generations beyond the cap as part of the switch,
but pruning only drops a generation as a GC root — the store paths
themselves still need an actual collect to free the disk. Do that right
after every jupiter switch rather than waiting up to a week for
gc.dates=weekly to matter again.
This commit is contained in:
2026-07-29 21:43:28 +02:00
parent 93a4e09a73
commit 585aff3652
+20
View File
@@ -838,6 +838,26 @@ case "$cmd" in
else else
"${rebuild[@]}" "${rebuild[@]}"
fi fi
# jupiter's 29G eMMC has no room to just let generations pile up between
# gc.dates=weekly runs (common.nix) — that's exactly how it filled up
# once already. configurationLimit=5 (also common.nix) makes
# switch-to-configuration prune generations beyond 5 as part of the
# switch above, but pruning a generation only drops it as a GC root —
# the store paths themselves still need an actual collect to free the
# disk. So do that here, right after every switch, rather than waiting
# up to a week for it to matter again.
if [ "$cmd" = switch ] && [ "$config" = jupiter ]; then
echo ">> jupiter: collecting garbage post-switch (keeps the eMMC under the 5-generation cap)"
need ssh
if [ -n "$pw" ]; then
printf '%s\n' "$pw" | ssh "darman@$host" 'sudo -S nix-collect-garbage -d' \
|| echo ">> warning: post-switch gc on jupiter failed — check disk space by hand" >&2
else
ssh -t "darman@$host" 'sudo nix-collect-garbage -d' \
|| echo ">> warning: post-switch gc on jupiter failed — check disk space by hand" >&2
fi
fi
unset pw unset pw
;; ;;