From 55288bff6af682bb706b8dbec598f6a16e3ba71a Mon Sep 17 00:00:00 2001 From: Antoine Viallon Date: Tue, 5 May 2026 12:10:55 +0200 Subject: [PATCH] feat(nix): add automatic generation deletion based on configurationLimit. Seriously, it should be the default --- nix/nix.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/nix/nix.nix b/nix/nix.nix index 3d46e20..6ae66bb 100644 --- a/nix/nix.nix +++ b/nix/nix.nix @@ -92,6 +92,19 @@ in }; }; + systemd.services.nix-delete-generations = mkIf (config.aviallon.boot.configurationLimit != null) { + script = '' + nix-env --delete-generations +${toString config.aviallon.boot.configurationLimit} --profile /nix/var/nix/profiles/system + ''; + path = [ config.nix.package ]; + restartIfChanged = false; + reloadIfChanged = false; + startAt = "Sun 03:00:00"; + enableStrictShellChecks = true; + after = [ "multi-user.target" "nix-daemon.socket" ]; + wants = [ "multi-user.target" "nix-daemon.socket" ]; + }; + nix.package = optimizePkg { stdenv = pkgs.fastStdenv; level = "slower";