-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add port type #48687
Add port type #48687
Conversation
This change leads to an additional check of the port number at build time, making invalid port values impossible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that change and can imagine several places where this can be fairly useful.
But it would be great to have this properly documented as well, in nixos/doc/manual/development/option-types.xml
you can add types.port
. :)
I have just added documentation for the type. Is it enough or should I write more about it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
But I'd prefer to wait for at least another maintainer for confirmation :)
I'd like it to have this type be used on all options that use integer ports, can you do that? |
👍 Have come across services that incorrectly set their port type to |
Motivation for this change
Many port values in nixos modules use types.int as a type. This allows invalid port numbers to be set. In theory, you could use types.ints.u16 instead, but types.port is more idiomatic. This change might lead to a wider usage of this type.
As an example, the sshd module has been changed to use the new type for the port.
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)