mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-20 04:31:52 +00:00
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.
This commit is contained in:
parent
3d479813f5
commit
c58654e2b7
|
@ -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" ];
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue