lib.types.boundedInt: init

This commit is contained in:
tv 2023-02-03 18:10:41 +01:00
parent 90b46307b5
commit 7b8f46c398

View File

@ -287,6 +287,12 @@ rec {
}; };
}); });
boundedInt = min: max: mkOptionType {
name = "bounded integer";
check = x: isInt x && min <= x && x <= max;
merge = mergeOneOption;
};
positive = mkOptionType { positive = mkOptionType {
name = "positive integer"; name = "positive integer";
check = x: isInt x && x > 0; check = x: isInt x && x > 0;