diff --git a/lib/types.nix b/lib/types.nix index ca6794e274c..d1ece2402ad 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -169,6 +169,9 @@ rec { # s32 = sign 32 4294967296; }; + # Alias of u16 for a port number + port = ints.u16; + float = mkOptionType rec { name = "float"; description = "floating point number"; diff --git a/nixos/doc/manual/development/option-types.xml b/nixos/doc/manual/development/option-types.xml index e6c9eae11a7..d993e47bc91 100644 --- a/nixos/doc/manual/development/option-types.xml +++ b/nixos/doc/manual/development/option-types.xml @@ -106,7 +106,7 @@ - + types.ints.{u8, u16, u32} @@ -131,6 +131,17 @@ + + + types.port + + + + A port number. This type is an alias to + types.ints.u16. + + + diff --git a/nixos/modules/services/networking/ssh/sshd.nix b/nixos/modules/services/networking/ssh/sshd.nix index c16fbe8a52f..5fab79f1b3d 100644 --- a/nixos/modules/services/networking/ssh/sshd.nix +++ b/nixos/modules/services/networking/ssh/sshd.nix @@ -130,7 +130,7 @@ in }; ports = mkOption { - type = types.listOf types.int; + type = types.listOf types.port; default = [22]; description = '' Specifies on which ports the SSH daemon listens.