nameserver parsing fix

This commit is contained in:
Eric Litak 2020-11-24 14:54:15 -08:00
parent 10e8dfe80a
commit 1f4ca1ba1a

View file

@ -84,10 +84,7 @@ EOF
extraRules1=""
fi
nameservers=()
while IFS='' read -r line; do
nameservers+=("$line")
done < <(grep ^nameserver /etc/resolv.conf | cut -f2 -d' ')
readarray nameservers < <(grep ^nameserver /etc/resolv.conf | sed -r 's/^nameserver[[:space:]]+([0-9.a-fA-F]+).*/"\1"/')
if [[ "$eth0_name" = eth* ]]; then
predictable_inames="usePredictableInterfaceNames = lib.mkForce false;"
@ -99,9 +96,7 @@ EOF
# This file was populated at runtime with the networking
# details gathered from the active system.
networking = {
nameservers = [$(for a in "${nameservers[@]}"; do echo -n "
$a"; done)
];
nameservers = [ ${nameservers[@]} ];
defaultGateway = "${gateway}";
defaultGateway6 = "${gateway6}";
dhcpcd.enable = false;