# #128 — weekly generation prune: system + Home Manager profiles. # Policy: drop gens older than 14 days only when they are beyond the # three most recent *past* generations (current always kept). { config, lib, pkgs, ... }: { config = { environment.systemPackages = [ pkgs.nomarchy-gen-prune ]; # Stock nix.gc --delete-older-than has no keep-N floor and would fight # this policy. Keep weekly store GC for dead paths only; generation # selection is nomarchy-gen-prune's job. nix.gc = { automatic = lib.mkDefault true; dates = lib.mkDefault "weekly"; # Empty options → collect unreferenced store paths only (no age-based # profile generation wipe). options = lib.mkDefault ""; }; systemd.services.nomarchy-gen-prune = { description = "Prune old NixOS and Home Manager generations (14d, keep ≥3 past)"; serviceConfig = { Type = "oneshot"; ExecStart = "${pkgs.nomarchy-gen-prune}/bin/nomarchy-gen-prune"; }; # After the stock store GC timer if both fire weekly. after = [ "nix-gc.service" ]; }; systemd.timers.nomarchy-gen-prune = { description = "Weekly Nix generation prune (Nomarchy #128)"; wantedBy = [ "timers.target" ]; timerConfig = { OnCalendar = "weekly"; Persistent = true; RandomizedDelaySec = "1h"; }; }; }; }