From 6372ea4f4f9fb8ccfe5ed9c2571b07895910498a Mon Sep 17 00:00:00 2001
From: tv <tv@krebsco.de>
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/types.nix')

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;
-- 
cgit v1.2.3