lib.types.boundedInt: init

This commit is contained in:
tv 2023-02-03 18:10:41 +01:00
parent 90b46307b5
commit 7b8f46c398
1 changed files with 6 additions and 0 deletions

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 {
name = "positive integer";
check = x: isInt x && x > 0;