From 575555ce140e1a6572c2a4eee45c05ea005b57a7 Mon Sep 17 00:00:00 2001 From: pingu Date: Wed, 16 Jul 2025 23:00:21 +0200 Subject: [PATCH] Cleaning old packages --- src/SUMMARY.md | 1 + src/configuration/clean.md | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 src/configuration/clean.md diff --git a/src/SUMMARY.md b/src/SUMMARY.md index 39f5c77..207b9c4 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -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) diff --git a/src/configuration/clean.md b/src/configuration/clean.md new file mode 100644 index 0000000..19755f9 --- /dev/null +++ b/src/configuration/clean.md @@ -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.