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 # resolv.conf from static nameserver 184.108.40.206 # 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 (GitHub - erikarvstedt/extra-container: Run declarative NixOS containers without full system rebuilds) if that changes anything.
( slightly related; NixOS 20.03 Feature Freeze - #24 by Moredread )