diff --git a/README.md b/README.md index 3afd118..8a55cff 100644 --- a/README.md +++ b/README.md @@ -242,7 +242,9 @@ systemctl --failed * https://nixos.org/manual/nix/stable/package-management/garbage-collection.html * https://discourse.nixos.org/t/why-doesnt-nix-collect-garbage-remove-old-generations-from-efi-menu/17592/4 -For all profiles: +This is automated in [base.nix](modules/base.nix) with the `nix.gc` option. + +Run manually for all profiles: ```shell sudo nix-collect-garbage --delete-older-than 14d diff --git a/modules/base.nix b/modules/base.nix index 1b3babc..11b5aac 100644 --- a/modules/base.nix +++ b/modules/base.nix @@ -121,6 +121,13 @@ nix.settings.auto-optimise-store = true; + # https://nixos.wiki/wiki/Storage_optimization#Automation + nix.gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 7d"; + }; + # Firewall. # https://nixos.wiki/wiki/Firewall # -> Firewall rules may be overwritten by docker, as per https://github.com/NixOS/nixpkgs/issues/111852