treewide: deprecate ip-up.target (#18319)

Systemd upstream provides targets for networking. This also includes a target network-online.target.

In this PR I remove / replace most occurrences since some of them were even wrong and could delay startup.

+4 -4
nixos/modules/config/networking.nix
···
# Install the proxy environment variables
environment.sessionVariables = cfg.proxy.envVars;
-
# The ‘ip-up’ target is started when we have IP connectivity. So
-
# services that depend on IP connectivity (like ntpd) should be
-
# pulled in by this target.
-
systemd.targets.ip-up.description = "Services Requiring IP Connectivity";
# This is needed when /etc/resolv.conf is being overriden by networkd
# and other configurations. If the file is destroyed by an environment
···
# Install the proxy environment variables
environment.sessionVariables = cfg.proxy.envVars;
+
# The ‘ip-up’ target is kept for backwards compatibility.
+
# New services should use systemd upstream targets:
+
# See https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/
+
systemd.targets.ip-up.description = "Services Requiring IP Connectivity (deprecated)";
# This is needed when /etc/resolv.conf is being overriden by networkd
# and other configurations. If the file is destroyed by an environment
+3 -1
nixos/modules/services/databases/4store-endpoint.nix
···
services.avahi.enable = true;
systemd.services."4store-endpoint" = {
-
wantedBy = [ "ip-up.target" ];
script = ''
${run} '${pkgs.rdf4store}/bin/4s-httpd -D ${cfg.options} ${if cfg.listenAddress!=null then "-H ${cfg.listenAddress}" else "" } -p ${toString cfg.port} ${cfg.database}'
'';
···
services.avahi.enable = true;
systemd.services."4store-endpoint" = {
+
after = [ "network.target" ];
+
wantedBy = [ "multi-user.target" ];
+
script = ''
${run} '${pkgs.rdf4store}/bin/4s-httpd -D ${cfg.options} ${if cfg.listenAddress!=null then "-H ${cfg.listenAddress}" else "" } -p ${toString cfg.port} ${cfg.database}'
'';
+2 -1
nixos/modules/services/databases/4store.nix
···
services.avahi.enable = true;
systemd.services."4store" = {
-
wantedBy = [ "ip-up.target" ];
preStart = ''
mkdir -p ${stateDir}/
···
services.avahi.enable = true;
systemd.services."4store" = {
+
after = [ "network.target" ];
+
wantedBy = [ "multi-user.target" ];
preStart = ''
mkdir -p ${stateDir}/
+2 -1
nixos/modules/services/databases/virtuoso.nix
···
};
systemd.services.virtuoso = {
-
wantedBy = [ "ip-up.target" ];
preStart = ''
mkdir -p ${stateDir}
···
};
systemd.services.virtuoso = {
+
after = [ "network.target" ];
+
wantedBy = [ "multi-user.target" ];
preStart = ''
mkdir -p ${stateDir}
+2 -1
nixos/modules/services/mail/freepops.nix
···
config = mkIf cfg.enable {
systemd.services.freepopsd = {
description = "Freepopsd (webmail over POP3)";
-
wantedBy = [ "ip-up.target" ];
script = ''
${pkgs.freepops}/bin/freepopsd \
-p ${toString cfg.port} \
···
config = mkIf cfg.enable {
systemd.services.freepopsd = {
description = "Freepopsd (webmail over POP3)";
+
after = [ "network.target" ];
+
wantedBy = [ "multi-user.target" ];
script = ''
${pkgs.freepops}/bin/freepopsd \
-p ${toString cfg.port} \
+4 -3
nixos/modules/services/monitoring/ups.nix
···
systemd.services.upsmon = {
description = "Uninterruptible Power Supplies (Monitor)";
-
wantedBy = [ "ip-up.target" ];
serviceConfig.Type = "forking";
script = "${pkgs.nut}/sbin/upsmon";
environment.NUT_CONFPATH = "/etc/nut/";
···
systemd.services.upsd = {
description = "Uninterruptible Power Supplies (Daemon)";
wantedBy = [ "multi-user.target" ];
-
after = [ "network-interfaces.target" "upsmon.service" ];
serviceConfig.Type = "forking";
# TODO: replace 'root' by another username.
script = "${pkgs.nut}/sbin/upsd -u root";
···
systemd.services.upsdrv = {
description = "Uninterruptible Power Supplies (Register all UPS)";
-
wantedBy = [ "multi-user.target" ];
after = [ "upsd.service" ];
# TODO: replace 'root' by another username.
script = ''${pkgs.nut}/bin/upsdrvctl -u root start'';
serviceConfig = {
···
systemd.services.upsmon = {
description = "Uninterruptible Power Supplies (Monitor)";
+
after = [ "network.target" ];
+
wantedBy = [ "multi-user.target" ];
serviceConfig.Type = "forking";
script = "${pkgs.nut}/sbin/upsmon";
environment.NUT_CONFPATH = "/etc/nut/";
···
systemd.services.upsd = {
description = "Uninterruptible Power Supplies (Daemon)";
+
after = [ "network.target" "upsmon.service" ];
wantedBy = [ "multi-user.target" ];
serviceConfig.Type = "forking";
# TODO: replace 'root' by another username.
script = "${pkgs.nut}/sbin/upsd -u root";
···
systemd.services.upsdrv = {
description = "Uninterruptible Power Supplies (Register all UPS)";
after = [ "upsd.service" ];
+
wantedBy = [ "multi-user.target" ];
# TODO: replace 'root' by another username.
script = ''${pkgs.nut}/bin/upsdrvctl -u root start'';
serviceConfig = {
+2 -2
nixos/modules/services/network-filesystems/drbd.nix
···
};
systemd.services.drbd = {
-
after = [ "systemd-udev.settle.service" ];
wants = [ "systemd-udev.settle.service" ];
-
wantedBy = [ "ip-up.target" ];
script = ''
${pkgs.drbd}/sbin/drbdadm up all
'';
···
};
systemd.services.drbd = {
+
after = [ "systemd-udev.settle.service" "network.target" ];
wants = [ "systemd-udev.settle.service" ];
+
wantedBy = [ "multi-user.target" ];
script = ''
${pkgs.drbd}/sbin/drbdadm up all
'';
+2 -1
nixos/modules/services/networking/amuled.nix
···
systemd.services.amuled = {
description = "AMule daemon";
-
wantedBy = [ "ip-up.target" ];
preStart = ''
mkdir -p ${cfg.dataDir}
···
systemd.services.amuled = {
description = "AMule daemon";
+
wantedBy = [ "multi-user.target" ];
+
after = [ "network.target" ];
preStart = ''
mkdir -p ${cfg.dataDir}
-7
nixos/modules/services/networking/dhcpcd.nix
···
${cfg.extraConfig}
'';
-
# Hook for emitting ip-up/ip-down events.
exitHook = pkgs.writeText "dhcpcd.exit-hook"
''
if [ "$reason" = BOUND -o "$reason" = REBOOT ]; then
···
# applies to openntpd.
${config.systemd.package}/bin/systemctl try-restart ntpd.service
${config.systemd.package}/bin/systemctl try-restart openntpd.service
-
-
${config.systemd.package}/bin/systemctl start ip-up.target
fi
-
-
#if [ "$reason" = EXPIRE -o "$reason" = RELEASE -o "$reason" = NOCARRIER ] ; then
-
# ${config.systemd.package}/bin/systemctl start ip-down.target
-
#fi
${cfg.runHook}
'';
···
${cfg.extraConfig}
'';
exitHook = pkgs.writeText "dhcpcd.exit-hook"
''
if [ "$reason" = BOUND -o "$reason" = REBOOT ]; then
···
# applies to openntpd.
${config.systemd.package}/bin/systemctl try-restart ntpd.service
${config.systemd.package}/bin/systemctl try-restart openntpd.service
fi
${cfg.runHook}
'';
+2 -1
nixos/modules/services/networking/git-daemon.nix
···
};
systemd.services."git-daemon" = {
-
wantedBy = [ "ip-up.target" ];
script = "${pkgs.git}/bin/git daemon --reuseaddr "
+ (optionalString (cfg.basePath != "") "--base-path=${cfg.basePath} ")
+ (optionalString (cfg.listenAddress != "") "--listen=${cfg.listenAddress} ")
···
};
systemd.services."git-daemon" = {
+
after = [ "network.target" ];
+
wantedBy = [ "multi-user.target" ];
script = "${pkgs.git}/bin/git daemon --reuseaddr "
+ (optionalString (cfg.basePath != "") "--base-path=${cfg.basePath} ")
+ (optionalString (cfg.listenAddress != "") "--listen=${cfg.listenAddress} ")
+4 -2
nixos/modules/services/networking/iodine.nix
···
createIodineClientService = name: cfg:
{
description = "iodine client - ${name}";
-
wantedBy = [ "ip-up.target" ];
serviceConfig = {
RestartSec = "30s";
Restart = "always";
···
) // {
iodined = mkIf (cfg.server.enable) {
description = "iodine, ip over dns server daemon";
-
wantedBy = [ "ip-up.target" ];
serviceConfig.ExecStart = "${pkgs.iodine}/bin/iodined -f -u ${iodinedUser} ${cfg.server.extraConfig} ${cfg.server.ip} ${cfg.server.domain}";
};
};
···
createIodineClientService = name: cfg:
{
description = "iodine client - ${name}";
+
after = [ "network.target" ];
+
wantedBy = [ "multi-user.target" ];
serviceConfig = {
RestartSec = "30s";
Restart = "always";
···
) // {
iodined = mkIf (cfg.server.enable) {
description = "iodine, ip over dns server daemon";
+
after = [ "network.target" ];
+
wantedBy = [ "multi-user.target" ];
serviceConfig.ExecStart = "${pkgs.iodine}/bin/iodined -f -u ${iodinedUser} ${cfg.server.extraConfig} ${cfg.server.ip} ${cfg.server.domain}";
};
};
-1
nixos/modules/services/networking/networkmanager.nix
···
ipUpScript = writeScript "01nixos-ip-up" ''
#!/bin/sh
if test "$2" = "up"; then
-
${config.systemd.package}/bin/systemctl start ip-up.target
${config.systemd.package}/bin/systemctl start network-online.target
fi
'';
···
ipUpScript = writeScript "01nixos-ip-up" ''
#!/bin/sh
if test "$2" = "up"; then
${config.systemd.package}/bin/systemctl start network-online.target
fi
'';
+1 -2
nixos/modules/system/boot/networkd.nix
···
};
systemd.services.systemd-networkd-wait-online = {
-
before = [ "ip-up.target" ];
-
wantedBy = [ "network-online.target" "ip-up.target" ];
};
systemd.services."systemd-network-wait-online@" = {
···
};
systemd.services.systemd-networkd-wait-online = {
+
wantedBy = [ "network-online.target" ];
};
systemd.services."systemd-network-wait-online@" = {
+1 -1
nixos/modules/tasks/network-interfaces-scripted.nix
···
# (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 ip-up.target
'';
preStop = flip concatMapStrings (ips) (ip:
let
···
# (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
+2 -1
nixos/modules/virtualisation/azure-agent.nix
···
systemd.services.waagent = {
wantedBy = [ "multi-user.target" ];
-
after = [ "ip-up.target" "sshd.service" ];
path = [ pkgs.e2fsprogs ];
description = "Windows Azure Agent Service";
···
systemd.services.waagent = {
wantedBy = [ "multi-user.target" ];
+
after = [ "network-online.target" "sshd.service" ];
+
wants = [ "network-online.target" ];
path = [ pkgs.e2fsprogs ];
description = "Windows Azure Agent Service";
+2 -2
nixos/modules/virtualisation/brightbox-image.nix
···
wantedBy = [ "multi-user.target" "sshd.service" ];
before = [ "sshd.service" ];
-
wants = [ "ip-up.target" ];
-
after = [ "ip-up.target" ];
path = [ pkgs.wget pkgs.iproute ];
···
wantedBy = [ "multi-user.target" "sshd.service" ];
before = [ "sshd.service" ];
+
wants = [ "network-online.target" ];
+
after = [ "network-online.target" ];
path = [ pkgs.wget pkgs.iproute ];
+2 -2
nixos/modules/virtualisation/google-compute-image.nix
···
wantedBy = [ "sshd.service" ];
before = [ "sshd.service" ];
-
after = [ "network-online.target" "ip-up.target" ];
-
wants = [ "network-online.target" "ip-up.target" ];
script = let wget = "${pkgs.wget}/bin/wget --retry-connrefused -t 15 --waitretry=10 --header='Metadata-Flavor: Google'";
mktemp = "mktemp --tmpdir=/run"; in
···
wantedBy = [ "sshd.service" ];
before = [ "sshd.service" ];
+
after = [ "network-online.target" ];
+
wants = [ "network-online.target" ];
script = let wget = "${pkgs.wget}/bin/wget --retry-connrefused -t 15 --waitretry=10 --header='Metadata-Flavor: Google'";
mktemp = "mktemp --tmpdir=/run"; in