lib.types.lowerBoundedInt: init
This commit is contained in:
parent
7b8f46c398
commit
3b04273d5c
@ -293,15 +293,21 @@ rec {
|
|||||||
merge = mergeOneOption;
|
merge = mergeOneOption;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
lowerBoundedInt = min: mkOptionType {
|
||||||
|
name = "lower bounded integer";
|
||||||
|
check = x: isInt x && min <= x;
|
||||||
|
merge = mergeOneOption;
|
||||||
|
};
|
||||||
|
|
||||||
positive = mkOptionType {
|
positive = mkOptionType {
|
||||||
|
inherit (lowerBoundedInt 1) check;
|
||||||
name = "positive integer";
|
name = "positive integer";
|
||||||
check = x: isInt x && x > 0;
|
|
||||||
merge = mergeOneOption;
|
merge = mergeOneOption;
|
||||||
};
|
};
|
||||||
|
|
||||||
uint = mkOptionType {
|
uint = mkOptionType {
|
||||||
|
inherit (lowerBoundedInt 0) check;
|
||||||
name = "unsigned integer";
|
name = "unsigned integer";
|
||||||
check = x: isInt x && x >= 0;
|
|
||||||
merge = mergeOneOption;
|
merge = mergeOneOption;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user