about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/types.nix6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/types.nix b/lib/types.nix
index db3bd3815238..e921f7f6d9fc 100644
--- a/lib/types.nix
+++ b/lib/types.nix
@@ -114,6 +114,12 @@ rec {
       merge = mergeOneOption;
     };
 
+    intBetween = min: max:
+      addCheck types.int (x: x >= min && x <= max) // {
+        name = "intBetween";
+        description = "integer between ${toString min} and ${toString max} (both inclusively)";
+      };
+
     str = mkOptionType {
       name = "str";
       description = "string";