From 7b8f46c398b459bdbb9650465d5912100dd5f3fe Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 3 Feb 2023 18:10:41 +0100 Subject: lib.types.boundedInt: init --- lib/types.nix | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib') diff --git a/lib/types.nix b/lib/types.nix index 32b4541ae..cda338130 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; -- cgit v1.2.3