remove old gc roots before running nix gc
This commit is contained in:
parent
1b2b53fbf6
commit
559f9e170b
1 changed files with 14 additions and 0 deletions
|
@ -1,7 +1,21 @@
|
||||||
{
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
nix.gc = {
|
nix.gc = {
|
||||||
automatic = true;
|
automatic = true;
|
||||||
options = "--delete-older-than 14d";
|
options = "--delete-older-than 14d";
|
||||||
};
|
};
|
||||||
nix.optimise.automatic = true;
|
nix.optimise.automatic = true;
|
||||||
|
|
||||||
|
systemd.services.remove-old-nix-gc-roots = let
|
||||||
|
beforeDate = "last month";
|
||||||
|
in {
|
||||||
|
description = "Remove old nix gc roots";
|
||||||
|
script = "exec ${lib.getExe pkgs.findutils} /nix/var/nix/gcroots/auto -not -newermt \"${beforeDate}\" -delete";
|
||||||
|
serviceConfig.Type = "oneshot";
|
||||||
|
before = ["nix-gc.service"];
|
||||||
|
requiredBy = ["nix-gc.service"];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue