Adding entries to /etc/host in nixos


#1

/etc/host is not changeable after you do a nixos-rebuild. So, I need to specify how to add entries during rebuild. How do you tell nixos to add entries to /etc/host?


#2

see networking.extraHosts


#3

as @tohl2 wrote, networking.extraHosts is what you are looking for.A convenient way to quickly check for options is the NixOS Options Website


#5

You can also use networking.hosts if you prefer writing them in Nix. They’ll be merged with all the other hosts already in that file.


#6

Actually now that i know of this option, i’d rather prefer networking.hosts.
brb, rewriting all my modules and config!