mirror of
https://github.com/nix-community/home-manager.git
synced 2024-12-14 11:57:55 +00:00
nix-gc: add randomizedDelaySec
option
There's no launchd equivalent to this option, so this is a no-op on Darwin.
This commit is contained in:
parent
c77c3bb233
commit
6cc03e337a
3 changed files with 15 additions and 0 deletions
|
@ -81,6 +81,18 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
randomizedDelaySec = lib.mkOption {
|
||||
default = "0";
|
||||
type = lib.types.singleLineStr;
|
||||
example = "45min";
|
||||
description = ''
|
||||
Add a randomized delay before each garbage collection.
|
||||
The delay will be chosen between zero and this value.
|
||||
This value must be a time span in the format specified by
|
||||
{manpage}`systemd.time(7)`
|
||||
'';
|
||||
};
|
||||
|
||||
options = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
|
@ -121,6 +133,7 @@ in {
|
|||
Unit = { Description = "Nix Garbage Collector"; };
|
||||
Timer = {
|
||||
OnCalendar = "${cfg.frequency}";
|
||||
RandomizedDelaySec = cfg.randomizedDelaySec;
|
||||
Persistent = cfg.persistent;
|
||||
Unit = "nix-gc.service";
|
||||
};
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
nix.gc = {
|
||||
automatic = true;
|
||||
frequency = "monthly";
|
||||
randomizedDelaySec = "42min";
|
||||
options = "--delete-older-than 30d --max-freed $((64 * 1024**3))";
|
||||
};
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ WantedBy=timers.target
|
|||
[Timer]
|
||||
OnCalendar=monthly
|
||||
Persistent=true
|
||||
RandomizedDelaySec=42min
|
||||
Unit=nix-gc.service
|
||||
|
||||
[Unit]
|
||||
|
|
Loading…
Reference in a new issue