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
NixOS /etc/hosts improvements #27804
Conversation
We really don't need to make exceptions for localhost in the generation of the host entries if we feed the entries for localhost back into the module system via the networking.hosts option itself. Signed-off-by: aszlig <aszlig@redmoonstudios.org>
The order of the hosts does matter here, so instead of passing a list, we can now also use an attribute set of "canonical" and "aliases" options to specify what we exactly want. I'm coercing the old form of specifying host entries (a plain list) to the new form, although this is probably a bad idea, because we have no real control over the canonical name and while it might be convenient to just say 'networking.hosts."1.2.3.4" = [ "host1" "host2" ]' it doesn't really merge well if "1.2.3.4" is already defined somewhere else. So I'm not really sure whether we want to remove the list variant or use a custom merging function to merge values into aliases if there's another definition with a canonical hostname and use the first item if there's no such definition. Using such a merging function would probably confuse the hell out of our users, so we might want to drop it soon. Signed-off-by: aszlig <aszlig@redmoonstudios.org>
What are the use cases for this? Worried that we're over-engineering /etc/hosts. |
@edolstra: The main point here is to improve on mergability of the options defined in So let's say you have the following definition: {
networking.hosts."1.2.3.4" = [ "foo" "bar" ];
} This leads to the canonical hostname { lib, ... }: {
networking.hosts."1.2.3.4" = lib.mkBefore [ "xyz" ];
} Now we have |
@volth: What exactly are you referring to? Edit: Ah, didn't see your comment on the referenced PR. That's the reason why I've added So if there is some interest in this PR, the idea would be to merge the list form into aliases if a canonical name is already defined. |
Any update on this pull request? |
@mmahut: Hm, I guess I won't pursue this further, hence closing. |
The goal is to improve
networking.hosts
so that we have more control over whether to set the canonical hostname or aliases of it.This was originally discussed in #27105 starting with this comment.