1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-26 21:19:45 +01:00

nix.gc: let systemd use any time config

This commit is contained in:
Scott Edlund 2024-03-17 17:54:44 +08:00 committed by Robert Helgesson
parent baf7659448
commit 93dcc3daa9
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED

View file

@ -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 = {