From 1f6f21249e13fdbe3f6707535d13ddd96b2ffde1 Mon Sep 17 00:00:00 2001 From: Bernardo Magri Date: Wed, 15 Jul 2026 11:55:58 +0100 Subject: [PATCH] =?UTF-8?q?docs(agent):=20#128=20=E2=80=94=2014d=20prune?= =?UTF-8?q?=20for=20system=20and=20Home=20Manager=20gens?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Same floor (keep current + ≥3 past); age window 14 days not 30; apply independently to system and HM profiles. --- agent/BACKLOG.md | 47 +++++++++++++++++++++++++---------------------- agent/JOURNAL.md | 10 +++++----- 2 files changed, 30 insertions(+), 27 deletions(-) diff --git a/agent/BACKLOG.md b/agent/BACKLOG.md index ddd7081..a168fe4 100644 --- a/agent/BACKLOG.md +++ b/agent/BACKLOG.md @@ -78,40 +78,43 @@ cable leaves. Capture steps in HARDWARE-QUEUE. ## NEXT -### 128. Auto-prune NixOS generations: >30 days, but keep ≥3 past +### 128. Auto-prune system + HM generations: >14 days, but keep ≥3 past -Bernardo 2026-07-15: automatic cleanup of **NixOS** (system) generations -so the boot menu and store do not grow without bound, with a safety floor: +Bernardo 2026-07-15 (refined same day): automatic cleanup of **both** +NixOS (system) and Home Manager (per-user) generations so boot menu, +desktop rollback, and store do not grow without bound, with a safety floor: -1. **Age:** candidates older than **30 days** may be removed. +1. **Age:** candidates older than **14 days** may be removed. 2. **Count floor:** always keep the **current** generation and at least - **3 past** generations — even if those three are older than 30 days. -3. Combined: delete only gens that are **both** older than 30 days **and** - older than the third-most-recent past generation. Gens within 30 days + **3 past** generations — even if those three are older than 14 days. +3. Combined: delete only gens that are **both** older than 14 days **and** + older than the third-most-recent past generation. Gens within 14 days stay regardless of how many there are (until they age out). +4. **Apply the same rule independently** to the system profile and to each + user's Home Manager profile (desktop rollback in Recovery › Desktop). **Why this shape:** pure age GC (`--delete-older-than`) can wipe a machine that is rarely rebuilt down to one generation and remove useful rollback targets; pure count limits (`configurationLimit`) drop recent work just because the user iterates a lot. Age + floor keeps travel-laptop machines -safe and busy desktops tidy. +safe and busy desktops tidy. 14d matches the existing store GC cadence +rather than a longer 30d hold. **Today:** `nix.gc` is already weekly with `--delete-older-than 14d` -(`modules/nixos/default.nix`) — store GC, no min-generation floor, and -14d not 30d. This item should replace/refine that policy (or add a -dedicated generation pruner if stock GC cannot express the floor). +(`modules/nixos/default.nix`) — store GC, **no** min-generation floor, and +it is not framed as an explicit dual system+HM policy. This item should +replace/refine that (or add a dedicated pruner if stock GC cannot express +the floor on both profiles). Bootloader list +(`boot.loader.systemd-boot.configurationLimit`) may need to stay in sync +so removed system profiles do not leave dead boot entries. -**Scope (settle if needed):** system profile only vs also Home Manager -user generations (desktop rollback in Recovery). Bootloader list -(`boot.loader.systemd-boot.configurationLimit`) may need to stay in -sync so removed profiles do not leave dead boot entries. - -Pass = weekly (or post-rebuild) cleanup enforces 30d + keep ≥3 past on -system generations; a machine with only old gens never goes below -current+3; docs/RECOVERY still matches the boot-menu story; doctor or a -check asserts the timer/unit exists and the prune script's dry-run -logic. V3: run on a box with many gens and confirm boot menu + -`nix-env -p /nix/var/nix/profiles/system --list-generations`. +Pass = weekly (or post-rebuild) cleanup enforces 14d + keep ≥3 past on +**system and HM** generations; a machine with only old gens never goes +below current+3 on either profile; docs/RECOVERY still matches boot-menu +and desktop rollback; doctor or a check asserts the timer/unit exists and +the prune script's dry-run logic. V3: box with many gens — boot menu + +`nix-env -p /nix/var/nix/profiles/system --list-generations` + +`home-manager generations` after a prune. ### 120. A netinstall ISO, next to the fat offline one diff --git a/agent/JOURNAL.md b/agent/JOURNAL.md index 2f121a3..e442271 100644 --- a/agent/JOURNAL.md +++ b/agent/JOURNAL.md @@ -20,12 +20,12 @@ Template: --- ## 2026-07-15 — File #128 generation auto-prune policy (no code) -- **Task:** Bernardo: auto-clean NixOS gens older than 30 days but always - keep ≥3 past generations. -- **Did:** NEXT **#128**. Policy restated; noted existing `nix.gc` weekly - `--delete-older-than 14d` has no min-generation floor. +- **Task:** Bernardo: auto-clean gens older than N days but always keep + ≥3 past; include HM; prefer 14d over 30d. +- **Did:** NEXT **#128** — system **and** Home Manager; **14 days** + keep + ≥3 past. Noted existing `nix.gc` weekly 14d has no min-generation floor. - **Verified:** V0 (docs/agent only). -- **Pending:** implement when picked; optional HM gens scope. +- **Pending:** implement when picked. - **Next suggestion:** implement #128, or human #115/#120. ## 2026-07-15 — #111 Recovery + #105 System IA + #110 retire Control Center