You could try checking of cloud-init is overriding these?
Alternatively, dhcpd also overrides this stuff sometimes.
(From 25.05 we found that the nix ‘source of truth’ isn’t quite as truthy as it used to be for networking related stuff due to these other two sources of truth.)
I had the same problem and in the end manually created resolve.conf so I would be interested in a solution as well. This is especially annoying as tailscale mDNS doesn’t really work then.
environment.etc."resolv.conf".text = ''
# Generated by environment.etc (NixOS static DNS fix)
nameserver 127.0.0.1
nameserver ::1
# Trust the AD (authentic data) flag and use EDNS(0)
options trust-ad edns0
'';
I’m not sure how you came up with that given that it’s not a valid resolv.conf file, a better way to declare the nameservers might be
environment.etc."resolv.conf".text = ''
# Use the local DNS resolver
nameserver 127.0.0.1
nameserver ::1
# Trust the AD (authentic data) flag and use EDNS(0)
options trust-ad edns0
'';
If you disable resolvconf even the static entries from networking.nameservers will not be installed, so this is not the right solution.
# Generated by resolvconf
This is strange, because with resolvconf.enable = false if some program invokes resolvconf to update /etc/resolv.conf it should fail with this message:
resolvconf is disabled on this system but was used anyway
I would say that either you didn’t really disable it, or are looking at an old file. Please, check what’s inside /etc/resolvconf.conf.
Anyway, with NetworkManager you can use services.networkmanager.insertNameservers to provide some servers with higher priority than those from DHCP.