Skip to content

Commit e9860fa

Browse files
gravndalGaetanLepage
authored andcommitted
nixos/snapper: use more precise type definition
1 parent f557b32 commit e9860fa

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

nixos/modules/services/misc/snapper.nix

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,13 @@ let
3535
descriptionClass = "conjunction";
3636
};
3737

38-
intOrSafeStr = lib.types.either lib.types.ints.unsigned safeStr;
38+
intOrNumberOrRange = lib.types.either lib.types.ints.unsigned (
39+
lib.types.strMatching "[[:digit:]]+(\-[[:digit:]]+)?"
40+
// {
41+
description = "string containing either a number or a range";
42+
descriptionClass = "conjunction";
43+
}
44+
);
3945

4046
configOptions = {
4147
SUBVOLUME = lib.mkOption {
@@ -95,47 +101,47 @@ let
95101
};
96102

97103
TIMELINE_LIMIT_HOURLY = lib.mkOption {
98-
type = intOrSafeStr;
104+
type = intOrNumberOrRange;
99105
default = 10;
100106
description = ''
101107
Limits for timeline cleanup.
102108
'';
103109
};
104110

105111
TIMELINE_LIMIT_DAILY = lib.mkOption {
106-
type = intOrSafeStr;
112+
type = intOrNumberOrRange;
107113
default = 10;
108114
description = ''
109115
Limits for timeline cleanup.
110116
'';
111117
};
112118

113119
TIMELINE_LIMIT_WEEKLY = lib.mkOption {
114-
type = intOrSafeStr;
120+
type = intOrNumberOrRange;
115121
default = 0;
116122
description = ''
117123
Limits for timeline cleanup.
118124
'';
119125
};
120126

121127
TIMELINE_LIMIT_MONTHLY = lib.mkOption {
122-
type = intOrSafeStr;
128+
type = intOrNumberOrRange;
123129
default = 10;
124130
description = ''
125131
Limits for timeline cleanup.
126132
'';
127133
};
128134

129135
TIMELINE_LIMIT_QUARTERLY = lib.mkOption {
130-
type = intOrSafeStr;
136+
type = intOrNumberOrRange;
131137
default = 0;
132138
description = ''
133139
Limits for timeline cleanup.
134140
'';
135141
};
136142

137143
TIMELINE_LIMIT_YEARLY = lib.mkOption {
138-
type = intOrSafeStr;
144+
type = intOrNumberOrRange;
139145
default = 10;
140146
description = ''
141147
Limits for timeline cleanup.

0 commit comments

Comments
 (0)