auto cleaning of nix store using nix-sweep

This commit is contained in:
2026-03-15 03:35:37 +01:00
parent 44162eb509
commit 82b5c755d6
4 changed files with 78 additions and 1 deletions
+18 -1
View File
@@ -1,10 +1,27 @@
{ config, lib, pkgs, modulesPath, ... }:
let
keepGenerations = if config.boot.lanzaboote.enable then
config.boot.lanzaboote.configurationLimit
else if config.boot.loader.systemd-boot.enable then
config.boot.loader.systemd-boot.configurationLimit
else null;
in
{
nix = {
daemonIOSchedClass = "idle";
daemonCPUSchedPolicy = "idle";
settings.trusted-users = [ "root" "user" ];
gc.automatic = true;
};
# Clean up nix store from old configurations usinx nix-sweep
services.nix-sweep = {
enable = true;
# Automatically determine configuration limit from bootloader
keepMax = keepGenerations;
keepMin = if keepGenerations != null then keepGenerations else 10;
gc = true; # Run GC afterwards
};
}