feat(nixos): prune system+HM gens after 14d, keep ≥3 past (#128)
Some checks failed
Check / eval (push) Has been cancelled
Some checks failed
Check / eval (push) Has been cancelled
Weekly nomarchy-gen-prune deletes only generations that are both older than 14 days and beyond the three most recent past gens (current always kept), for system and Home Manager profiles. Stock nix.gc no longer uses --delete-older-than. checks.gen-prune covers selection self-test and unit wiring; doctor points at the new tool when disk is tight.
This commit is contained in:
@@ -60,7 +60,7 @@ for mp in / /boot /nix; do
|
||||
avail=$(numfmt --to=iec $((availkb * 1024)))
|
||||
if [ "$use" -ge 90 ]; then
|
||||
bad "$mp is ${use}% full (${avail} free)" \
|
||||
"sudo nix-collect-garbage --delete-older-than 14d (then sys-rebuild to prune old boot entries)"
|
||||
"sudo nomarchy-gen-prune (14d + keep ≥3 past system/HM gens; then reclaims store)"
|
||||
else
|
||||
ok "$mp has space (${use}% used, ${avail} free)"
|
||||
fi
|
||||
@@ -127,6 +127,21 @@ else
|
||||
skip "system generation age (no system profile)"
|
||||
fi
|
||||
|
||||
# ── generation prune (#128: 14d + keep ≥3 past, system + HM) ─────────
|
||||
if [ -n "$(systemctl list-unit-files nomarchy-gen-prune.timer --no-legend --plain 2>/dev/null)" ]; then
|
||||
if systemctl is-enabled --quiet nomarchy-gen-prune.timer 2>/dev/null; then
|
||||
ok "generation prune timer is enabled (14d, keep ≥3 past)"
|
||||
else
|
||||
bad "nomarchy-gen-prune.timer is installed but not enabled" \
|
||||
"systemctl enable --now nomarchy-gen-prune.timer"
|
||||
fi
|
||||
elif command -v nomarchy-gen-prune >/dev/null 2>&1; then
|
||||
warn "nomarchy-gen-prune is on PATH but no timer unit" \
|
||||
"rebuild the system so gen-prune.nix ships the weekly timer"
|
||||
else
|
||||
skip "generation prune (package not on this machine)"
|
||||
fi
|
||||
|
||||
# ── snapper timeline (when enabled) ──────────────────────────────────
|
||||
if [ -n "$(systemctl list-unit-files snapper-timeline.timer --no-legend --plain 2>/dev/null)" ]; then
|
||||
if systemctl is-active --quiet snapper-timeline.timer; then
|
||||
|
||||
Reference in New Issue
Block a user