lib/types: add intBetween

An int type that checks the value range.
This commit is contained in:
Profpatsch
2017-11-05 15:56:32 +01:00
parent cdbe4671be
commit c53d874277
2 changed files with 17 additions and 0 deletions
+6
View File
@@ -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";