Cleaning old packages

This commit is contained in:
2025-07-16 23:00:21 +02:00
parent 161f6ac745
commit 575555ce14
2 changed files with 17 additions and 0 deletions

View File

@ -11,6 +11,7 @@
- [GUI](./configuration/GUI.md)
- [Home-manager](./configuration/hm.md)
- [How to find new software and configure](./configuration/new.md)
- [Cleaning old packages](./configuration/clean.md)
- [Building your own software](./build/index.md)
- [Dev shells](./build/devshell.md)
- [Packages](./build/packages.md)

View File

@ -0,0 +1,16 @@
# Cleaning old packages
By default, packages installed will be kept after each rebuild, even if they are not active anymore.
You can manually garbage collect with `nix-collect-garbage -d` to remove all the old generations.
One can however do this automatically using the following:
```nix
nix.gc = {
automatic = true;
persistent = true;
dates = "weekly";
options = "--delete-older-than 14d";
};
```
This will check every week, and delete packages that aren't used that active, that also are older than 14 days.
If the timing of the check was missed, due to the system being powered down or similar, it will attempt at the closest time it can.