Skip to content

Commit 600719f

Browse files
nix-gc: rename frequency to dates
1 parent 3ec1cd9 commit 600719f

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

modules/services/nix-gc.nix

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
...
66
}:
77
let
8-
inherit (lib) mkOption types;
8+
inherit (lib) mkRenamedOptionModule mkOption types;
99

1010
cfg = config.nix.gc;
1111

@@ -15,6 +15,10 @@ in
1515
{
1616
meta.maintainers = [ lib.maintainers.shivaraj-bh ];
1717

18+
imports = [
19+
(mkRenamedOptionModule [ "nix" "gc" "frequency" ] [ "nix" "gc" "dates" ])
20+
];
21+
1822
options = {
1923
nix.gc = {
2024
automatic = mkOption {
@@ -27,7 +31,7 @@ in
2731
'';
2832
};
2933

30-
frequency = mkOption {
34+
dates = mkOption {
3135
type = types.str;
3236
default = "weekly";
3337
example = "03:15";
@@ -97,7 +101,7 @@ in
97101
Description = "Nix Garbage Collector";
98102
};
99103
Timer = {
100-
OnCalendar = "${cfg.frequency}";
104+
OnCalendar = "${cfg.dates}";
101105
RandomizedDelaySec = cfg.randomizedDelaySec;
102106
Persistent = cfg.persistent;
103107
Unit = "nix-gc.service";
@@ -110,7 +114,7 @@ in
110114

111115
(lib.mkIf pkgs.stdenv.isDarwin {
112116
assertions = [
113-
(lib.hm.darwin.assertInterval "nix.gc.frequency" cfg.frequency pkgs)
117+
(lib.hm.darwin.assertInterval "nix.gc.dates" cfg.dates pkgs)
114118
];
115119

116120
launchd.agents.nix-gc = {
@@ -120,7 +124,7 @@ in
120124
"${nixPackage}/bin/nix-collect-garbage"
121125
]
122126
++ lib.optional (cfg.options != null) cfg.options;
123-
StartCalendarInterval = lib.hm.darwin.mkCalendarInterval cfg.frequency;
127+
StartCalendarInterval = lib.hm.darwin.mkCalendarInterval cfg.dates;
124128
};
125129
};
126130
})

tests/modules/services/nix-gc/darwin/basic.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
nix.gc = {
33
automatic = true;
4-
frequency = "monthly";
4+
dates = "monthly";
55
options = "--delete-older-than 30d";
66
};
77

tests/modules/services/nix-gc/darwin/darwin-nix-gc-interval-assertion.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
nix.gc = {
33
automatic = true;
4-
frequency = "00:02:03";
4+
dates = "00:02:03";
55
};
66

77
test.asserts.assertions.expected = [

tests/modules/services/nix-gc/linux/basic.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
nix.gc = {
33
automatic = true;
4-
frequency = "monthly";
4+
dates = "monthly";
55
randomizedDelaySec = "42min";
66
options = "--delete-older-than 30d --max-freed $((64 * 1024**3))";
77
};

0 commit comments

Comments
 (0)