diff --git a/modules/common.nix b/modules/common.nix index dca178a..d7011c9 100644 --- a/modules/common.nix +++ b/modules/common.nix @@ -7,5 +7,6 @@ ./common/services.nix ./common/networking.nix ./common/system.nix + ./common/garbage-collection.nix ]; } diff --git a/modules/common/garbage-collection.nix b/modules/common/garbage-collection.nix new file mode 100644 index 0000000..d437dd7 --- /dev/null +++ b/modules/common/garbage-collection.nix @@ -0,0 +1,31 @@ +{ config, lib, pkgs, ... }: + +{ + # ───────────────────────────────────────────── + # Bootloader generation limit (rollback window) + # ───────────────────────────────────────────── + boot.loader.systemd-boot.configurationLimit = 3; + # If you're using GRUB instead, use this instead: + # boot.loader.grub.configurationLimit = 3; + + # ───────────────────────────────────────────── + # Nix garbage collection (tight retention) + # ───────────────────────────────────────────── + nix.gc = { + automatic = true; + dates = "daily"; + options = "--delete-older-than 3d"; + }; + + # ───────────────────────────────────────────── + # Store optimisation (reduce disk bloat) + # ───────────────────────────────────────────── + nix.settings.auto-optimise-store = true; + + # ───────────────────────────────────────────── + # Optional: keep system leaner overall + # (reduces leftover system profiles slightly) + # ───────────────────────────────────────────── + nix.settings.keep-outputs = false; + nix.settings.keep-derivations = false; +} \ No newline at end of file