diff options
author | tv <tv@krebsco.de> | 2023-02-03 18:10:41 +0100 |
---|---|---|
committer | tv <tv@krebsco.de> | 2023-02-05 01:40:20 +0100 |
commit | 6372ea4f4f9fb8ccfe5ed9c2571b07895910498a (patch) | |
tree | ca412c87b9661a96cc73b218d9a809eb5a8555eb /lib/types.nix | |
parent | 880eb5310d3ddf8da4907aadb7ecdf45f2f892d3 (diff) |
lib.types.boundedInt: init
Diffstat (limited to 'lib/types.nix')
-rw-r--r-- | lib/types.nix | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/types.nix b/lib/types.nix index 32b4541..cda3381 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -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; |