summary refs log tree commit diff
diff options
context:
space:
mode:
authorWilliam A. Kennington III <william@wkennington.com>2014-11-26 11:19:31 -0800
committerWilliam A. Kennington III <william@wkennington.com>2014-11-26 16:29:24 -0800
commit1860ee27b0e4aae2cc0ed997e14b0d3289ce498f (patch)
tree09c605f6540a30bd074b74ea94760f1736c55f75
parent4f2a041345445dc4727b3d56e7458552517e6cd5 (diff)
downloadnixpkgs-1860ee27b0e4aae2cc0ed997e14b0d3289ce498f.tar
nixpkgs-1860ee27b0e4aae2cc0ed997e14b0d3289ce498f.tar.gz
nixpkgs-1860ee27b0e4aae2cc0ed997e14b0d3289ce498f.tar.bz2
nixpkgs-1860ee27b0e4aae2cc0ed997e14b0d3289ce498f.tar.lz
nixpkgs-1860ee27b0e4aae2cc0ed997e14b0d3289ce498f.tar.xz
nixpkgs-1860ee27b0e4aae2cc0ed997e14b0d3289ce498f.tar.zst
nixpkgs-1860ee27b0e4aae2cc0ed997e14b0d3289ce498f.zip
nixos/networking: Fixes
-rw-r--r--nixos/modules/config/networking.nix6
-rw-r--r--nixos/modules/services/networking/chrony.nix4
-rw-r--r--nixos/modules/services/networking/dhcpcd.nix6
-rw-r--r--nixos/modules/services/networking/gogoclient.nix3
-rw-r--r--nixos/modules/services/networking/ntpd.nix3
-rw-r--r--nixos/modules/services/networking/openntpd.nix3
-rw-r--r--nixos/modules/system/boot/stage-2-init.sh2
-rw-r--r--nixos/modules/system/boot/systemd.nix2
-rw-r--r--nixos/modules/tasks/filesystems/nfs.nix6
-rw-r--r--nixos/modules/tasks/network-interfaces-scripted.nix2
-rw-r--r--nixos/modules/tasks/network-interfaces.nix6
11 files changed, 20 insertions, 23 deletions
diff --git a/nixos/modules/config/networking.nix b/nixos/modules/config/networking.nix
index 711cbb2b70b..773d0b1f1a7 100644
--- a/nixos/modules/config/networking.nix
+++ b/nixos/modules/config/networking.nix
@@ -112,8 +112,10 @@ in
           ln -s /run/systemd/resolve/resolv.conf /run/resolvconf/interfaces/systemd
         ''}
 
-        # Make sure resolv.conf is up to date
-        ${pkgs.openresolv}/bin/resolvconf -u
+        # Make sure resolv.conf is up to date if not managed by systemd
+        ${optionalString (!config.services.resolved.enable) ''
+          ${pkgs.openresolv}/bin/resolvconf -u
+        ''}
       '';
 
   };
diff --git a/nixos/modules/services/networking/chrony.nix b/nixos/modules/services/networking/chrony.nix
index d1684dd9f05..a6edd9d03bf 100644
--- a/nixos/modules/services/networking/chrony.nix
+++ b/nixos/modules/services/networking/chrony.nix
@@ -99,8 +99,8 @@ in
     jobs.chronyd =
       { description = "chrony daemon";
 
-        wantedBy = [ "ip-up.target" ];
-        partOf = [ "ip-up.target" ];
+        wantedBy = [ "multi-user.target" ];
+        after = [ "network.target" ];
 
         path = [ chrony ];
 
diff --git a/nixos/modules/services/networking/dhcpcd.nix b/nixos/modules/services/networking/dhcpcd.nix
index 115ca5ce2ab..1ad8cbae15c 100644
--- a/nixos/modules/services/networking/dhcpcd.nix
+++ b/nixos/modules/services/networking/dhcpcd.nix
@@ -15,7 +15,7 @@ let
   # Don't start dhcpcd on explicitly configured interfaces or on
   # interfaces that are part of a bridge, bond or sit device.
   ignoredInterfaces =
-    map (i: i.name) (filter (i: if i.useDHCP != null then i.useDHCP else i.ip4 != [ ] || i.ipAddress != null) interfaces)
+    map (i: i.name) (filter (i: if i.useDHCP != null then !i.useDHCP else i.ip4 != [ ] || i.ipAddress != null) interfaces)
     ++ mapAttrsToList (i: _: i) config.networking.sits
     ++ concatLists (attrValues (mapAttrs (n: v: v.interfaces) config.networking.bridges))
     ++ concatLists (attrValues (mapAttrs (n: v: v.interfaces) config.networking.bonds))
@@ -28,7 +28,8 @@ let
   # If dhcp is disabled but explicit interfaces are enabled,
   # we need to provide dhcp just for those interfaces.
   allowInterfaces = arrayAppendOrNull cfg.allowInterfaces
-    (if !cfg.useDHCP && enableDHCP then map (i: i.name) (filter (i: i.useDHCP == true) interfaces) else null);
+    (if !config.networking.useDHCP && enableDHCP then
+      map (i: i.name) (filter (i: i.useDHCP == true) interfaces) else null);
 
   # Config file adapted from the one that ships with dhcpcd.
   dhcpcdConf = pkgs.writeText "dhcpcd.conf"
@@ -71,7 +72,6 @@ let
           ${config.systemd.package}/bin/systemctl try-restart ntpd.service
 
           ${config.systemd.package}/bin/systemctl start ip-up.target
-          ${config.systemd.package}/bin/systemctl start network-online.target
       fi
 
       #if [ "$reason" = EXPIRE -o "$reason" = RELEASE -o "$reason" = NOCARRIER ] ; then
diff --git a/nixos/modules/services/networking/gogoclient.nix b/nixos/modules/services/networking/gogoclient.nix
index 41600794197..9d16f0efb43 100644
--- a/nixos/modules/services/networking/gogoclient.nix
+++ b/nixos/modules/services/networking/gogoclient.nix
@@ -76,8 +76,7 @@ in
         exec ${pkgs.gogoclient}/bin/gogoc -y -f /var/lib/gogoc/gogoc.conf
       '';
     } // optionalAttrs cfg.autorun {
-      wantedBy = [ "ip-up.target" ];
-      partOf = [ "ip-up.target" ];
+      wantedBy = [ "multi-user.target" ];
     };
 
   };
diff --git a/nixos/modules/services/networking/ntpd.nix b/nixos/modules/services/networking/ntpd.nix
index 2f638904406..faaa3421cc1 100644
--- a/nixos/modules/services/networking/ntpd.nix
+++ b/nixos/modules/services/networking/ntpd.nix
@@ -76,8 +76,7 @@ in
     jobs.ntpd =
       { description = "NTP Daemon";
 
-        wantedBy = [ "ip-up.target" ];
-        partOf = [ "ip-up.target" ];
+        wantedBy = [ "multi-user.target" ];
 
         path = [ ntp ];
 
diff --git a/nixos/modules/services/networking/openntpd.nix b/nixos/modules/services/networking/openntpd.nix
index bd8a7a04a2a..2f9031481d1 100644
--- a/nixos/modules/services/networking/openntpd.nix
+++ b/nixos/modules/services/networking/openntpd.nix
@@ -41,8 +41,7 @@ in
 
     systemd.services.openntpd = {
       description = "OpenNTP Server";
-      wantedBy = [ "ip-up.target" ];
-      partOf = [ "ip-up.target" ];
+      wantedBy = [ "multi-user.target" ];
       serviceConfig.ExecStart = "${package}/sbin/ntpd -d -f ${cfgFile}";
     };
   };
diff --git a/nixos/modules/system/boot/stage-2-init.sh b/nixos/modules/system/boot/stage-2-init.sh
index 6fff776f858..3762bda94a5 100644
--- a/nixos/modules/system/boot/stage-2-init.sh
+++ b/nixos/modules/system/boot/stage-2-init.sh
@@ -141,8 +141,6 @@ fi
 # Use /etc/resolv.conf supplied by systemd-nspawn, if applicable.
 if [ -n "@useHostResolvConf@" -a -e /etc/resolv.conf ]; then
     cat /etc/resolv.conf | resolvconf -m 1000 -a host
-else
-    touch /etc/resolv.conf
 fi
 
 
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix
index 290b2538332..89029a098e9 100644
--- a/nixos/modules/system/boot/systemd.nix
+++ b/nixos/modules/system/boot/systemd.nix
@@ -945,6 +945,8 @@ in
         unitConfig.X-StopOnReconfiguration = true;
       };
 
+    systemd.targets.network-online.after = [ "ip-up.target" ];
+
     systemd.units =
       mapAttrs' (n: v: nameValuePair "${n}.target" (targetToUnit n v)) cfg.targets
       // mapAttrs' (n: v: nameValuePair "${n}.service" (serviceToUnit n v)) cfg.services
diff --git a/nixos/modules/tasks/filesystems/nfs.nix b/nixos/modules/tasks/filesystems/nfs.nix
index 16752ce7e1b..f7f2d965806 100644
--- a/nixos/modules/tasks/filesystems/nfs.nix
+++ b/nixos/modules/tasks/filesystems/nfs.nix
@@ -73,8 +73,7 @@ in
 
         path = [ pkgs.nfsUtils pkgs.sysvtools pkgs.utillinux ];
 
-        wantedBy = [ "network-online.target" "multi-user.target" ];
-        before = [ "network-online.target" ];
+        wantedBy = [ "multi-user.target" ];
         requires = [ "basic.target" "rpcbind.service" ];
         after = [ "basic.target" "rpcbind.service" "network.target" ];
 
@@ -100,8 +99,7 @@ in
 
         path = [ pkgs.sysvtools pkgs.utillinux ];
 
-        wantedBy = [ "network-online.target" "multi-user.target" ];
-        before = [ "network-online.target" ];
+        wantedBy = [ "multi-user.target" ];
         requires = [ "rpcbind.service" ];
         after = [ "rpcbind.service" ];
 
diff --git a/nixos/modules/tasks/network-interfaces-scripted.nix b/nixos/modules/tasks/network-interfaces-scripted.nix
index 1ca629c186c..85bc697b0f4 100644
--- a/nixos/modules/tasks/network-interfaces-scripted.nix
+++ b/nixos/modules/tasks/network-interfaces-scripted.nix
@@ -114,6 +114,7 @@ in
             after = [ (subsystemDevice i.name) ];
             serviceConfig.Type = "oneshot";
             serviceConfig.RemainAfterExit = true;
+            path = [ pkgs.iproute ];
             script =
               ''
                 echo "bringing up interface..."
@@ -142,7 +143,6 @@ in
                     ${config.systemd.package}/bin/systemctl try-restart --no-block network-setup.service
                   fi
                   ${config.systemd.package}/bin/systemctl start ip-up.target
-                  ${config.systemd.package}/bin/systemctl start network-online.target
                 '';
             preStop =
               ''
diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix
index 08397cc9a30..080cb559cbb 100644
--- a/nixos/modules/tasks/network-interfaces.nix
+++ b/nixos/modules/tasks/network-interfaces.nix
@@ -624,13 +624,13 @@ in
         pkgs.iw
         pkgs.rfkill
         pkgs.openresolv
-      ]
+      ];
 
     systemd.services = {
       network-local-commands = {
         description = "Extra networking commands.";
-        before = [ "network.target" "network-online.target" ];
-        wantedBy = [ "network.target" "network-online.target" ];
+        before = [ "network.target" ];
+        wantedBy = [ "network.target" ];
         unitConfig.ConditionCapability = "CAP_NET_ADMIN";
         path = [ pkgs.iproute ];
         serviceConfig.Type = "oneshot";