summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/types.nix6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/types.nix b/lib/types.nix
index 32b4541ae..cda338130 100644
--- a/lib/types.nix
+++ b/lib/types.nix
@@ -287,6 +287,12 @@ rec {
};
});
+ boundedInt = min: max: mkOptionType {
+ name = "bounded integer";
+ check = x: isInt x && min <= x && x <= max;
+ merge = mergeOneOption;
+ };
+
positive = mkOptionType {
name = "positive integer";
check = x: isInt x && x > 0;