mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 03:29:45 +01: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 {
|
options = mkOption {
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
default = null;
|
default = null;
|
||||||
|
@ -121,6 +133,7 @@ in {
|
||||||
Unit = { Description = "Nix Garbage Collector"; };
|
Unit = { Description = "Nix Garbage Collector"; };
|
||||||
Timer = {
|
Timer = {
|
||||||
OnCalendar = "${cfg.frequency}";
|
OnCalendar = "${cfg.frequency}";
|
||||||
|
RandomizedDelaySec = cfg.randomizedDelaySec;
|
||||||
Persistent = cfg.persistent;
|
Persistent = cfg.persistent;
|
||||||
Unit = "nix-gc.service";
|
Unit = "nix-gc.service";
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
nix.gc = {
|
nix.gc = {
|
||||||
automatic = true;
|
automatic = true;
|
||||||
frequency = "monthly";
|
frequency = "monthly";
|
||||||
|
randomizedDelaySec = "42min";
|
||||||
options = "--delete-older-than 30d --max-freed $((64 * 1024**3))";
|
options = "--delete-older-than 30d --max-freed $((64 * 1024**3))";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ WantedBy=timers.target
|
||||||
[Timer]
|
[Timer]
|
||||||
OnCalendar=monthly
|
OnCalendar=monthly
|
||||||
Persistent=true
|
Persistent=true
|
||||||
|
RandomizedDelaySec=42min
|
||||||
Unit=nix-gc.service
|
Unit=nix-gc.service
|
||||||
|
|
||||||
[Unit]
|
[Unit]
|
||||||
|
|
Loading…
Reference in a new issue