NixOS / nixops

NixOps is a tool for deploying to NixOS machines in a network or cloud.
https://nixos.org/nixops
GNU Lesser General Public License v3.0
1.84k stars 363 forks source link

Add the possiblity to define extra hosts aliases #821

Open MartinPotier opened 6 years ago

MartinPotier commented 6 years ago

nixops generates an /etc/hosts referring to all machines by IP. That'd be usefull, in the case of virtualbox instances at least, to be able to declare extra aliases. Using the following fragment:

machineName.deployment.targetExtraAliases = ["alias1" "alias2"];

would generate the following /etc/hosts on machineName:

127.0.0.1  localhost
::1  localhost

…
192.168.xx.xx machineName machineName-unencrypted alias1 alias2
…

Doing so could relieve users from installing and running a local DNS server for the task.

KamilaBorowska commented 5 years ago

It's possible to workaround this by doing this:

{
    networking.extraHosts = "${nodes."NODE NAME".config.networking.privateIPv4} ALIAS";
}
WhittlesJr commented 3 years ago

+1 and a bump for 2021. It would be nice to get this for free.

WhittlesJr commented 3 years ago

Actually, to co-opt this a bit, it doesn't seem like nixops is adding the other machines to /etc/hosts at all... is that really supposed to be a feature?