feat(nix): bound the store, generations and boot menu (task 0014) #7

Merged
alexion merged 2 commits from task-0014-nix-store-housekeeping into main 2026-07-20 10:43:51 -04:00
Owner

Task: .claude/tasks/0014-nix-store-housekeeping.md

Bounds the three things that grew without limit on this machine, declared in the shared base config so every future host inherits them:

  • Weekly garbage collection, deleting generations older than 30 days.
  • Weekly store optimisation on a timer rather than at build time.
  • Retained boot configurations capped at 15.

Verified with nix flake check, plus inspection of the built toplevel: both timers are present, and the bootloader installer carries CONFIGURATION_LIMIT = int("15").

Deviations. The schedules are named days rather than the bare weekly keyword — systemd expands weekly to Mon *-*-* 00:00:00, which would have started collection and deduplication at the same instant, leaving nix-optimise hard-linking paths nix-gc was concurrently deleting. Collection runs Mon 03:15, optimisation Thu 03:45.

Review

Overall: MEDIUM

  • Blast radius: Medium — one file, but the base every host imports, so the timers and boot-entry cap land on all machines.
  • Reversibility: Medium — the lines revert trivially, their effects do not; once GC or the cap prunes a generation, that rollback target is gone.
  • Test coverage: Medium — nix flake check catches a bad option name or type, but nothing exercises the timers over time.
  • Sensitive domain: Low — no auth, secrets or permissions touched.
  • Size & complexity: Low — five declarative assignments, no logic.
  • Runtime criticality: Medium — bootloader state, and GC deleting a needed generation is exactly the recovery path this preserves.

Unaddressed findings

  • Standards, judgement call. Retention is expressed twice with no stated relationship — --delete-older-than 30d and configurationLimit = 15 — and the comment convention forbids either comment pointing at the other. Left as is: they bound different resources (store versus EFI partition), and merging them into one block would misdescribe both.
  • Spec, noted not fixed. The cap is set unconditionally in the shared base, so a future host on another bootloader inherits no cap. The task asks for it there, and the option is inert rather than an error off systemd-boot.
  • Spec, open criterion. "Manual confirmation after a rebuild" is unmet — it needs a nixos-rebuild switch, and this session had no sudo credential. It closes in a follow-up commit, as tasks 0013, 0016 and 0017 did.
Task: `.claude/tasks/0014-nix-store-housekeeping.md` Bounds the three things that grew without limit on this machine, declared in the shared base config so every future host inherits them: - Weekly garbage collection, deleting generations older than 30 days. - Weekly store optimisation on a timer rather than at build time. - Retained boot configurations capped at 15. Verified with `nix flake check`, plus inspection of the built toplevel: both timers are present, and the bootloader installer carries `CONFIGURATION_LIMIT = int("15")`. **Deviations.** The schedules are named days rather than the bare `weekly` keyword — systemd expands `weekly` to `Mon *-*-* 00:00:00`, which would have started collection and deduplication at the same instant, leaving `nix-optimise` hard-linking paths `nix-gc` was concurrently deleting. Collection runs `Mon 03:15`, optimisation `Thu 03:45`. ## Review **Overall: MEDIUM** - Blast radius: Medium — one file, but the base every host imports, so the timers and boot-entry cap land on all machines. - Reversibility: Medium — the lines revert trivially, their effects do not; once GC or the cap prunes a generation, that rollback target is gone. - Test coverage: Medium — `nix flake check` catches a bad option name or type, but nothing exercises the timers over time. - Sensitive domain: Low — no auth, secrets or permissions touched. - Size & complexity: Low — five declarative assignments, no logic. - Runtime criticality: Medium — bootloader state, and GC deleting a needed generation is exactly the recovery path this preserves. ### Unaddressed findings - **Standards, judgement call.** Retention is expressed twice with no stated relationship — `--delete-older-than 30d` and `configurationLimit = 15` — and the comment convention forbids either comment pointing at the other. Left as is: they bound different resources (store versus EFI partition), and merging them into one block would misdescribe both. - **Spec, noted not fixed.** The cap is set unconditionally in the shared base, so a future host on another bootloader inherits no cap. The task asks for it there, and the option is inert rather than an error off systemd-boot. - **Spec, open criterion.** "Manual confirmation after a rebuild" is unmet — it needs a `nixos-rebuild switch`, and this session had no sudo credential. It closes in a follow-up commit, as tasks 0013, 0016 and 0017 did.
alexion added 1 commit 2026-07-20 10:22:02 -04:00
Garbage collection and store optimisation each run weekly, on separate
days so they never contend, and retained boot configurations are capped
at 15.
alexion added 1 commit 2026-07-20 10:27:42 -04:00
alexion merged commit 0d685ce277 into main 2026-07-20 10:43:51 -04:00
alexion deleted branch task-0014-nix-store-housekeeping 2026-07-20 10:43:51 -04:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: alexion/dotfiles#7