File tree Expand file tree Collapse file tree 4 files changed +12
-8
lines changed
tests/modules/services/nix-gc Expand file tree Collapse file tree 4 files changed +12
-8
lines changed Original file line number Diff line number Diff line change 5
5
...
6
6
} :
7
7
let
8
- inherit ( lib ) mkOption types ;
8
+ inherit ( lib ) mkRenamedOptionModule mkOption types ;
9
9
10
10
cfg = config . nix . gc ;
11
11
15
15
{
16
16
meta . maintainers = [ lib . maintainers . shivaraj-bh ] ;
17
17
18
+ imports = [
19
+ ( mkRenamedOptionModule [ "nix" "gc" "frequency" ] [ "nix" "gc" "dates" ] )
20
+ ] ;
21
+
18
22
options = {
19
23
nix . gc = {
20
24
automatic = mkOption {
27
31
'' ;
28
32
} ;
29
33
30
- frequency = mkOption {
34
+ dates = mkOption {
31
35
type = types . str ;
32
36
default = "weekly" ;
33
37
example = "03:15" ;
97
101
Description = "Nix Garbage Collector" ;
98
102
} ;
99
103
Timer = {
100
- OnCalendar = "${ cfg . frequency } " ;
104
+ OnCalendar = "${ cfg . dates } " ;
101
105
RandomizedDelaySec = cfg . randomizedDelaySec ;
102
106
Persistent = cfg . persistent ;
103
107
Unit = "nix-gc.service" ;
110
114
111
115
( lib . mkIf pkgs . stdenv . isDarwin {
112
116
assertions = [
113
- ( lib . hm . darwin . assertInterval "nix.gc.frequency " cfg . frequency pkgs )
117
+ ( lib . hm . darwin . assertInterval "nix.gc.dates " cfg . dates pkgs )
114
118
] ;
115
119
116
120
launchd . agents . nix-gc = {
120
124
"${ nixPackage } /bin/nix-collect-garbage"
121
125
]
122
126
++ lib . optional ( cfg . options != null ) cfg . options ;
123
- StartCalendarInterval = lib . hm . darwin . mkCalendarInterval cfg . frequency ;
127
+ StartCalendarInterval = lib . hm . darwin . mkCalendarInterval cfg . dates ;
124
128
} ;
125
129
} ;
126
130
} )
Original file line number Diff line number Diff line change 1
1
{
2
2
nix . gc = {
3
3
automatic = true ;
4
- frequency = "monthly" ;
4
+ dates = "monthly" ;
5
5
options = "--delete-older-than 30d" ;
6
6
} ;
7
7
Original file line number Diff line number Diff line change 1
1
{
2
2
nix . gc = {
3
3
automatic = true ;
4
- frequency = "00:02:03" ;
4
+ dates = "00:02:03" ;
5
5
} ;
6
6
7
7
test . asserts . assertions . expected = [
Original file line number Diff line number Diff line change 1
1
{
2
2
nix . gc = {
3
3
automatic = true ;
4
- frequency = "monthly" ;
4
+ dates = "monthly" ;
5
5
randomizedDelaySec = "42min" ;
6
6
options = "--delete-older-than 30d --max-freed $((64 * 1024**3))" ;
7
7
} ;
You can’t perform that action at this time.
0 commit comments