summary refs log tree commit diff
path: root/nixos/modules/config/networking.nix
diff options
context:
space:
mode:
authorWilliam A. Kennington III <william@wkennington.com>2014-11-23 03:04:02 -0800
committerWilliam A. Kennington III <william@wkennington.com>2014-11-26 11:22:02 -0800
commit8cffa3778758039cdfdcd35c628796046686dfbf (patch)
treeabecc1fbfa36c7732f017e82f9f1ac1cf2fd4787 /nixos/modules/config/networking.nix
parent295a17f87249ffc042964aa40b217cf045f9830a (diff)
downloadnixlib-8cffa3778758039cdfdcd35c628796046686dfbf.tar
nixlib-8cffa3778758039cdfdcd35c628796046686dfbf.tar.gz
nixlib-8cffa3778758039cdfdcd35c628796046686dfbf.tar.bz2
nixlib-8cffa3778758039cdfdcd35c628796046686dfbf.tar.lz
nixlib-8cffa3778758039cdfdcd35c628796046686dfbf.tar.xz
nixlib-8cffa3778758039cdfdcd35c628796046686dfbf.tar.zst
nixlib-8cffa3778758039cdfdcd35c628796046686dfbf.zip
networkd: Support Host Resolvconf
Diffstat (limited to 'nixos/modules/config/networking.nix')
-rw-r--r--nixos/modules/config/networking.nix24
1 files changed, 9 insertions, 15 deletions
diff --git a/nixos/modules/config/networking.nix b/nixos/modules/config/networking.nix
index 21e211e1685c..3ab75123110b 100644
--- a/nixos/modules/config/networking.nix
+++ b/nixos/modules/config/networking.nix
@@ -43,10 +43,6 @@ in
 
   config = {
 
-    warnings =
-      optional (config.services.resolved.enable && config.environment.etc ? "resolvconf.conf")
-        "Openresolv is disabled if resolved is used, so resolvconf.conf is not referenced.";
-
     environment.etc =
       { # /etc/services: TCP/UDP port assignments.
         "services".source = pkgs.iana_etc + "/etc/services";
@@ -66,16 +62,7 @@ in
             ''}
             ${cfg.extraHosts}
           '';
-      } // (if config.services.resolved.enable && dnsmasqResolve then {
-        "dnsmasq-resolv.conf".source = "/run/systemd/resolve/resolv.conf";
-      } else {}) // (if config.services.resolved.enable then {
-        # /etc/resolv.conf: Configuration for systemd-resolved.
-        "resolv.conf" = if hasLocalResolver then {
-            text = "nameserver 127.0.0.1";
-          } else {
-            source = "/run/systemd/resolve/resolv.conf";
-          };
-      } else {
+
         # /etc/resolvconf.conf: Configuration for openresolv.
         "resolvconf.conf".text =
             ''
@@ -97,7 +84,14 @@ in
               dnsmasq_conf=/etc/dnsmasq-conf.conf
               dnsmasq_resolv=/etc/dnsmasq-resolv.conf
             '';
-      });
+
+      } // (optionalAttrs config.services.resolved.enable (
+        if dnsmasqResolve then {
+          "dnsmasq-resolv.conf".source = "/run/systemd/resolve/resolv.conf";
+        } else {
+          "resolv.conf".source = "/run/systemd/resolve/resolv.conf";
+        }
+      ));
 
     # The ‘ip-up’ target is started when we have IP connectivity.  So
     # services that depend on IP connectivity (like ntpd) should be