nixos

Adding networking hosts using NixOS configuration

The following configuration can be added to your NixOS configuration file in order to map hostnames to IP addresses on your local machine:

networking.hosts = {
  "127.0.0.1" = [ "foo.bar.baz" ];
};

After running nixos-rebuild you should see the following entry in your /etc/hosts symlink file:

127.0.0.1 foo.bar.baz

more Linux posts