From c58654e2b78e7d3ae97ba96c80ceb3f96236e463 Mon Sep 17 00:00:00 2001 From: Franz Pletz Date: Sun, 11 Sep 2016 08:13:04 +0200 Subject: [PATCH] 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. --- nixos/modules/services/networking/avahi-daemon.nix | 12 +----------- nixos/modules/services/networking/dhcpcd.nix | 7 +++---- nixos/modules/services/networking/networkmanager.nix | 10 ---------- nixos/modules/system/boot/systemd.nix | 2 -- nixos/modules/tasks/network-interfaces-scripted.nix | 1 - 5 files changed, 4 insertions(+), 28 deletions(-) diff --git a/nixos/modules/services/networking/avahi-daemon.nix b/nixos/modules/services/networking/avahi-daemon.nix index 2d3ce34a4e3a..ecc091d1d03d 100644 --- a/nixos/modules/services/networking/avahi-daemon.nix +++ b/nixos/modules/services/networking/avahi-daemon.nix @@ -7,10 +7,6 @@ let cfg = config.services.avahi; - # We must escape interfaces due to the systemd interpretation - subsystemDevice = interface: - "sys-subsystem-net-devices-${utils.escapeSystemdPath interface}.device"; - avahiDaemonConf = with cfg; pkgs.writeText "avahi-daemon.conf" '' [server] ${# Users can set `networking.hostName' to the empty string, when getting @@ -180,14 +176,8 @@ in environment.systemPackages = [ pkgs.avahi ]; systemd.services.avahi-daemon = - let - deps = optionals (cfg.interfaces!=null) (map subsystemDevice cfg.interfaces); - in { description = "Avahi daemon"; - wantedBy = [ "ip-up.target" ]; - bindsTo = deps; - after = deps; - before = [ "ip-up.target" ]; + wantedBy = [ "multi-user.target" ]; # Receive restart event after resume partOf = [ "post-resume.target" ]; diff --git a/nixos/modules/services/networking/dhcpcd.nix b/nixos/modules/services/networking/dhcpcd.nix index 994b857e5e80..49d74dfdf0f0 100644 --- a/nixos/modules/services/networking/dhcpcd.nix +++ b/nixos/modules/services/networking/dhcpcd.nix @@ -147,10 +147,9 @@ in systemd.services.dhcpcd = { description = "DHCP Client"; - wantedBy = [ "network.target" ]; - # Work-around to deal with problems where the kernel would remove & - # re-create Wifi interfaces early during boot. - after = [ "network-interfaces.target" ]; + wantedBy = [ "multi-user.target" ]; + wants = [ "network.target" ]; + before = [ "network.target" ]; # Stopping dhcpcd during a reconfiguration is undesirable # because it brings down the network interfaces configured by diff --git a/nixos/modules/services/networking/networkmanager.nix b/nixos/modules/services/networking/networkmanager.nix index aa190c553f8a..65ffaece4772 100644 --- a/nixos/modules/services/networking/networkmanager.nix +++ b/nixos/modules/services/networking/networkmanager.nix @@ -52,13 +52,6 @@ let }); ''; - ipUpScript = writeScript "01nixos-ip-up" '' - #!/bin/sh - if test "$2" = "up"; then - ${config.systemd.package}/bin/systemctl start network-online.target - fi - ''; - ns = xs: writeText "nameservers" ( concatStrings (map (s: "nameserver ${s}\n") xs) ); @@ -187,9 +180,6 @@ in { boot.kernelModules = [ "ppp_mppe" ]; # Needed for most (all?) PPTP VPN connections. environment.etc = with cfg.basePackages; [ - { source = ipUpScript; - target = "NetworkManager/dispatcher.d/01nixos-ip-up"; - } { source = configFile; target = "NetworkManager/NetworkManager.conf"; } diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index 3fa257f96685..397e9a4987b7 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -727,8 +727,6 @@ 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/network-interfaces-scripted.nix b/nixos/modules/tasks/network-interfaces-scripted.nix index 627762bd60de..d1b62e0fd4e4 100644 --- a/nixos/modules/tasks/network-interfaces-scripted.nix +++ b/nixos/modules/tasks/network-interfaces-scripted.nix @@ -142,7 +142,6 @@ in # (Flushing this interface may have removed it.) ${config.systemd.package}/bin/systemctl try-restart --no-block network-setup.service fi - ${config.systemd.package}/bin/systemctl start network-online.target ''; preStop = flip concatMapStrings (ips) (ip: let