diff options
author | Profpatsch <mail@profpatsch.de> | 2017-08-05 15:13:55 +0200 |
---|---|---|
committer | Profpatsch <mail@profpatsch.de> | 2017-11-05 15:56:32 +0100 |
commit | c776489cacb32d2cbfe0ba2622b2b6e4d27bae7d (patch) | |
tree | b441eecb499f4ad32c5f6715fb00cb7139943cd8 | |
parent | 281d071b6a5380a811c5b2f7493bbcf75461c7ff (diff) |
lib/types: add port type
-rw-r--r-- | lib/types.nix | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/types.nix b/lib/types.nix index 3dc99cd36f27f..cd59a00cfd866 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"; |