@@ -103,16 +103,18 @@ let
103103
104104 script =
105105 ''
106− # Set the static DNS configuration, if given.
107− ${pkgs.openresolv}/sbin/resolvconf -m 1 -a static <<EOF
108− ${optionalString (cfg.nameservers != [] && cfg.domain != null) ''
109− domain ${cfg.domain}
106+ ${optionalString (!config.environment.etc?"resolv.conf") ''
107+ # Set the static DNS configuration, if given.
108+ ${pkgs.openresolv}/sbin/resolvconf -m 1 -a static <<EOF
109+ ${optionalString (cfg.nameservers != [] && cfg.domain != null) ''
110+ domain ${cfg.domain}
111+ ''}
112+ ${optionalString (cfg.search != []) ("search " + concatStringsSep " " cfg.search)}
113+ ${flip concatMapStrings cfg.nameservers (ns: ''
114+ nameserver ${ns}
115+ '')}
116+ EOF
110117 ''}
111− ${optionalString (cfg.search != []) ("search " + concatStringsSep " " cfg.search)}
112− ${flip concatMapStrings cfg.nameservers (ns: ''
113− nameserver ${ns}
114− '')}
115− EOF
116118
117119 # Set the default gateway.
118120 ${optionalString (cfg.defaultGateway != null && cfg.defaultGateway.address != "") ''