summary refs log tree commit diff
path: root/nixos/modules/system
diff options
context:
space:
mode:
authorPeter Hoeg <peter@hoeg.com>2017-04-14 11:10:49 +0800
committerPeter Hoeg <peter@hoeg.com>2017-10-14 14:38:04 +0800
commit8f21e089a8de9eaa2512af25191d17077eca223a (patch)
tree99ae449583fcb9fa4eb20643d7ad7dc56d3b9724 /nixos/modules/system
parent8758f476b36e1d98ad2c854889c642ad6d86c505 (diff)
downloadnixlib-8f21e089a8de9eaa2512af25191d17077eca223a.tar
nixlib-8f21e089a8de9eaa2512af25191d17077eca223a.tar.gz
nixlib-8f21e089a8de9eaa2512af25191d17077eca223a.tar.bz2
nixlib-8f21e089a8de9eaa2512af25191d17077eca223a.tar.lz
nixlib-8f21e089a8de9eaa2512af25191d17077eca223a.tar.xz
nixlib-8f21e089a8de9eaa2512af25191d17077eca223a.tar.zst
nixlib-8f21e089a8de9eaa2512af25191d17077eca223a.zip
networkd: only wait for network to be online if configured to do so
Diffstat (limited to 'nixos/modules/system')
-rw-r--r--nixos/modules/system/boot/networkd.nix10
1 files changed, 6 insertions, 4 deletions
diff --git a/nixos/modules/system/boot/networkd.nix b/nixos/modules/system/boot/networkd.nix
index 9d2cea3ad165..85e5aa478f19 100644
--- a/nixos/modules/system/boot/networkd.nix
+++ b/nixos/modules/system/boot/networkd.nix
@@ -8,6 +8,8 @@ let
 
   cfg = config.systemd.network;
 
+  waitOnline = config.networking.waitForOnline;
+
   checkLink = checkUnitConfig "Link" [
     (assertOnlyFields [
       "Description" "Alias" "MACAddressPolicy" "MACAddress" "NamePolicy" "Name"
@@ -699,9 +701,9 @@ in
   config = mkIf config.systemd.network.enable {
 
     systemd.additionalUpstreamSystemUnits = [
-      "systemd-networkd.service" "systemd-networkd-wait-online.service"
       "org.freedesktop.network1.busname"
-    ];
+      "systemd-networkd.service"
+    ] ++ optional waitOnline "systemd-networkd-wait-online.service";
 
     systemd.network.units = mapAttrs' (n: v: nameValuePair "${n}.link" (linkToUnit n v)) cfg.links
       // mapAttrs' (n: v: nameValuePair "${n}.netdev" (netdevToUnit n v)) cfg.netdevs
@@ -714,11 +716,11 @@ in
       restartTriggers = map (f: f.source) (unitFiles);
     };
 
-    systemd.services.systemd-networkd-wait-online = {
+    systemd.services.systemd-networkd-wait-online = lib.mkIf waitOnline {
       wantedBy = [ "network-online.target" ];
     };
 
-    systemd.services."systemd-network-wait-online@" = {
+    systemd.services."systemd-network-wait-online@" = lib.mkIf waitOnline {
       description = "Wait for Network Interface %I to be Configured";
       conflicts = [ "shutdown.target" ];
       requisite = [ "systemd-networkd.service" ];