-
Notifications
You must be signed in to change notification settings - Fork 10
Support age-based retention in managed garbage collector (--delete-older-than) #169
Description
Problem
The managed garbage collector in determinate-nixd uses a disk-pressure-based strategy (keeping 5-20% free), which works well for preventing disk-full situations. However, there's no way to configure age-based retention — equivalent to nix-collect-garbage --delete-older-than 30d.
Use case
On NixOS, nix.gc supports both dates (schedule) and options = "--delete-older-than 30d" for predictable, time-based pruning of old generations. On nix-darwin with determinateNix.enable = true, nix.gc is unavailable (nix.enable is false), and there's no equivalent in the determinateNixd.garbageCollector config.
Age-based pruning is useful for:
- Keeping a predictable rollback window (e.g. "always keep last 30 days")
- Preventing unbounded accumulation of generations even when disk space is plentiful
- Matching the behavior users expect from
nix.gcon NixOS
Proposal
Add an option to the managed GC config (e.g. in determinateNixd.garbageCollector) for age-based retention, something like:
determinateNix.determinateNixd.garbageCollector = {
strategy = "automatic";
deleteOlderThan = "30d"; # optional, prune generations older than this
};This would complement the existing disk-pressure strategy rather than replace it.
Created on behalf of @schickling by Claude Code