I found some strange behavior of the nixos-containers.
When I assign a localAddress and a hostAddress, the container name is nicely added to /etc/hosts, and I can reach is with container-name.containers.
If I don’t do it, the container gets an network, but it isn’t added to /etc/hosts
In general, I try to care as little as possible about the numerical addresses, and defining them could lead to collisions. Is it possible to create containers with /etc/hosts entries without defining your own adresses?
Usually there is a nss-mymachines module that should resolve hostname to an ip for each container registered with machined.
However in the nixos-container case, scripts does take care of the network so machined does not its ip. Maybe there is a way around that. I was playing in the past with the machined dbus interface, maybe the ip address could be added this way.