nix.gc: let systemd use any time config
This commit is contained in:
parent
baf7659448
commit
93dcc3daa9
|
@ -4,6 +4,8 @@ with lib;
|
|||
|
||||
let
|
||||
cfg = config.nix.gc;
|
||||
darwinIntervals =
|
||||
[ "hourly" "daily" "weekly" "monthly" "semiannually" "annually" ];
|
||||
|
||||
mkCalendarInterval = frequency:
|
||||
let
|
||||
|
@ -66,21 +68,16 @@ in {
|
|||
};
|
||||
|
||||
frequency = mkOption {
|
||||
type = types.enum [
|
||||
"hourly"
|
||||
"daily"
|
||||
"weekly"
|
||||
"monthly"
|
||||
"semiannually"
|
||||
"annually"
|
||||
];
|
||||
type = types.str;
|
||||
default = "weekly";
|
||||
example = "monthly";
|
||||
example = "03:15";
|
||||
description = ''
|
||||
The frequency at which to run the garbage collector.
|
||||
When to run the Nix garbage collector.
|
||||
|
||||
These enums are based on special expressions from the
|
||||
{manpage}`systemd.time(7)`
|
||||
On Linux this is a string as defined by {manpage}`systemd.time(7)`.
|
||||
|
||||
On Darwin it must be one of: ${toString darwinIntervals}, which are
|
||||
implemented as defined in the manual page above.
|
||||
'';
|
||||
};
|
||||
|
||||
|
@ -117,6 +114,13 @@ in {
|
|||
})
|
||||
|
||||
(mkIf pkgs.stdenv.isDarwin {
|
||||
assertions = [{
|
||||
assertion = elem cfg.frequency darwinIntervals;
|
||||
message = "On Darwin nix.gc.frequency must be one of: ${
|
||||
toString darwinIntervals
|
||||
}.";
|
||||
}];
|
||||
|
||||
launchd.agents.nix-gc = {
|
||||
enable = true;
|
||||
config = {
|
||||
|
|
Loading…
Reference in a new issue