feat: automatic garbage collection

This commit is contained in:
Daniel Langbein 2023-10-08 21:09:25 +02:00
parent 2c563c54ee
commit 102ae0ee62
Signed by: langfingaz
GPG Key ID: 6C47C753F0823002
2 changed files with 10 additions and 1 deletions

View File

@ -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

View File

@ -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