mirror of
https://github.com/aviallon/nixos-lib.git
synced 2026-05-21 16:46:30 +00:00
feat(nix): add automatic generation deletion based on configurationLimit. Seriously, it should be the default
This commit is contained in:
parent
d649c49f0e
commit
55288bff6a
1 changed files with 13 additions and 0 deletions
13
nix/nix.nix
13
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";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue