How do containers use networking.useHostResolvConf?

As far as I can tell, my containers use the host resolv.conf by default, which was an issue when trying to use networking.nameservers, because the host config would override the manual configuration. I figured this out by accidentally running across resolvconf -l.

# resolvconf -l
# resolv.conf from static
nameserver 192.160.0.1

# resolv.conf from host
# Generated by resolvconf
nameserver 127.0.0.1
options edns0

This is the script that looked like it was doing nothing (systemctl status network-setup.service):

#! /nix/store/715fljdrspphbdk255r729zxp4w7lcgk-bash-4.4-p23/bin/bash -e
# Set the static DNS configuration, if given.
/nix/store/2dzm0djdyh59c258vhbc1npbra0f1rdn-openresolv-3.9.2/sbin/resolvconf -m 1 -a static <<EOF
nameserver 192.168.0.1
EOF

# Set the default gateway.

I’m using extra-container (https://github.com/erikarvstedt/extra-container) if that changes anything.

( slightly related; NixOS 20.03 Feature Freeze )

Not sure if extra-container does anything else, but I guess it’s this line:

I forgot to clarify that setting networking.useHostResolvConf = false; fixed the problem. (Or at least I’m pretty sure it did.)

Thanks tokudan! Ill take a look.

I just realized I accidentally a word in the topic;
How do containers set networking.useHostResolvConf? -> How do containers use networking.useHostResolvConf?

Some additional clarification: when the resolvconf script is run, everything behaves as defined, it’s just that the from host section is what ends up in `/etc/resolv.conf".