git.iko.soy/typeable/nixpkgs
on master help sign in
treewide: fix fallout of ip-up deprecation

See #18319 for details. Starting network-online.target manually does not work as it hangs indefinitely. Additionally, don't treat avahi and dhcpcd special and sync their systemd units with the respective upstream suggestion.

commitc58654e2b78e7d3ae97ba96c80ceb3f96236e463 authorFranz Pletz <fpletz@fnordicwalking.de> dateSun 11 Sep 2016, 08:13 (10 years ago) parent3d47981
5 files changed+4−28
nixos/modules/services/networking/avahi-daemon.nix+1−11 nixos/modules/services/networking/dhcpcd.nix+3−4 nixos/modules/services/networking/networkmanager.nix−10 nixos/modules/system/boot/systemd.nix−2 nixos/modules/tasks/network-interfaces-scripted.nix−1
nixos/modules/services/networking/avahi-daemon.nix+1−11
@@ -7,10 +7,6 @@ let
77
88 cfg = config.services.avahi;
99
10− # We must escape interfaces due to the systemd interpretation
11− subsystemDevice = interface:
12− "sys-subsystem-net-devices-${utils.escapeSystemdPath interface}.device";
13−
1410 avahiDaemonConf = with cfg; pkgs.writeText "avahi-daemon.conf" ''
1511 [server]
1612 ${# Users can set `networking.hostName' to the empty string, when getting
@@ -180,14 +176,8 @@ in
180176 environment.systemPackages = [ pkgs.avahi ];
181177
182178 systemd.services.avahi-daemon =
183− let
184− deps = optionals (cfg.interfaces!=null) (map subsystemDevice cfg.interfaces);
185− in
186179 { description = "Avahi daemon";
187− wantedBy = [ "ip-up.target" ];
188− bindsTo = deps;
189− after = deps;
190− before = [ "ip-up.target" ];
180+ wantedBy = [ "multi-user.target" ];
191181 # Receive restart event after resume
192182 partOf = [ "post-resume.target" ];
193183
nixos/modules/services/networking/dhcpcd.nix+3−4
@@ -147,10 +147,9 @@ in
147147 systemd.services.dhcpcd =
148148 { description = "DHCP Client";
149149
150− wantedBy = [ "network.target" ];
151− # Work-around to deal with problems where the kernel would remove &
152− # re-create Wifi interfaces early during boot.
153− after = [ "network-interfaces.target" ];
150+ wantedBy = [ "multi-user.target" ];
151+ wants = [ "network.target" ];
152+ before = [ "network.target" ];
154153
155154 # Stopping dhcpcd during a reconfiguration is undesirable
156155 # because it brings down the network interfaces configured by
nixos/modules/services/networking/networkmanager.nix−10
@@ -52,13 +52,6 @@ let
5252 });
5353 '';
5454
55− ipUpScript = writeScript "01nixos-ip-up" ''
56− #!/bin/sh
57− if test "$2" = "up"; then
58− ${config.systemd.package}/bin/systemctl start network-online.target
59− fi
60− '';
61−
6255 ns = xs: writeText "nameservers" (
6356 concatStrings (map (s: "nameserver ${s}\n") xs)
6457 );
@@ -187,9 +180,6 @@ in {
187180 boot.kernelModules = [ "ppp_mppe" ]; # Needed for most (all?) PPTP VPN connections.
188181
189182 environment.etc = with cfg.basePackages; [
190− { source = ipUpScript;
191− target = "NetworkManager/dispatcher.d/01nixos-ip-up";
192− }
193183 { source = configFile;
194184 target = "NetworkManager/NetworkManager.conf";
195185 }
nixos/modules/system/boot/systemd.nix−2
@@ -727,8 +727,6 @@ in
727727 unitConfig.X-StopOnReconfiguration = true;
728728 };
729729
730− systemd.targets.network-online.after = [ "ip-up.target" ];
731−
732730 systemd.units =
733731 mapAttrs' (n: v: nameValuePair "${n}.target" (targetToUnit n v)) cfg.targets
734732 // mapAttrs' (n: v: nameValuePair "${n}.service" (serviceToUnit n v)) cfg.services
nixos/modules/tasks/network-interfaces-scripted.nix−1
@@ -142,7 +142,6 @@ in
142142 # (Flushing this interface may have removed it.)
143143 ${config.systemd.package}/bin/systemctl try-restart --no-block network-setup.service
144144 fi
145− ${config.systemd.package}/bin/systemctl start network-online.target
146145 '';
147146 preStop = flip concatMapStrings (ips) (ip:
148147 let