diff --git a/scripts/deploy b/scripts/deploy index 5b29844..ef2feac 100755 --- a/scripts/deploy +++ b/scripts/deploy @@ -838,6 +838,26 @@ case "$cmd" in else "${rebuild[@]}" 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 ;;