summary refs log tree commit diff
path: root/lib/types.nix
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2017-08-05 15:13:55 +0200
committerProfpatsch <mail@profpatsch.de>2017-11-05 15:56:32 +0100
commitc776489cacb32d2cbfe0ba2622b2b6e4d27bae7d (patch)
treeb441eecb499f4ad32c5f6715fb00cb7139943cd8 /lib/types.nix
parent281d071b6a5380a811c5b2f7493bbcf75461c7ff (diff)
downloadnixpkgs-c776489cacb32d2cbfe0ba2622b2b6e4d27bae7d.tar
nixpkgs-c776489cacb32d2cbfe0ba2622b2b6e4d27bae7d.tar.gz
nixpkgs-c776489cacb32d2cbfe0ba2622b2b6e4d27bae7d.tar.bz2
nixpkgs-c776489cacb32d2cbfe0ba2622b2b6e4d27bae7d.tar.lz
nixpkgs-c776489cacb32d2cbfe0ba2622b2b6e4d27bae7d.tar.xz
nixpkgs-c776489cacb32d2cbfe0ba2622b2b6e4d27bae7d.tar.zst
nixpkgs-c776489cacb32d2cbfe0ba2622b2b6e4d27bae7d.zip
lib/types: add port type
Diffstat (limited to 'lib/types.nix')
-rw-r--r--lib/types.nix11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/types.nix b/lib/types.nix
index 3dc99cd36f2..cd59a00cfd8 100644
--- a/lib/types.nix
+++ b/lib/types.nix
@@ -120,16 +120,16 @@ rec {
         };
 
         betweenDesc = lowest: highest:
-          "${toString lowest} and ${toString highest} (both inclusive).";
+          "${toString lowest} and ${toString highest} (both inclusive)";
         between = lowest: highest: assert lowest <= highest;
           addCheck int (x: x >= lowest && x <= highest) // {
             name = "intBetween";
-            description = "Integer between ${betweenDesc lowest highest}";
+            description = "Integer between ${betweenDesc lowest highest}.";
           };
         ign = lowest: highest: name: docStart:
           between lowest highest // {
             inherit name;
-            description = docStart + " Between ${betweenDesc lowest highest}";
+            description = docStart + " Between ${betweenDesc lowest highest}.";
           };
         unsign = bit: range: ign 0 (range - 1)
           "unsignedInt${toString bit}" "${toString bit} bit unsigned integer.";
@@ -137,7 +137,7 @@ rec {
           "signedInt${toString bit}" "${toString bit} bit signed integer.";
 
       in rec {
-        /* an int with a fixed range
+        /* An int with a fixed range.
         *
         * Example:
         *   (ints.between 0 100).check (-1)
@@ -167,6 +167,9 @@ rec {
 
       };
 
+    /* A network port number */
+    port = ints.unsigned16;
+
     str = mkOptionType {
       name = "str";
       description = "string";