mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
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.
This commit is contained in:
parent
a28bbba6fc
commit
27bc34f1e4
17 changed files with 35 additions and 33 deletions
|
@ -223,10 +223,10 @@ in
|
||||||
# Install the proxy environment variables
|
# Install the proxy environment variables
|
||||||
environment.sessionVariables = cfg.proxy.envVars;
|
environment.sessionVariables = cfg.proxy.envVars;
|
||||||
|
|
||||||
# The ‘ip-up’ target is started when we have IP connectivity. So
|
# The ‘ip-up’ target is kept for backwards compatibility.
|
||||||
# services that depend on IP connectivity (like ntpd) should be
|
# New services should use systemd upstream targets:
|
||||||
# pulled in by this target.
|
# See https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/
|
||||||
systemd.targets.ip-up.description = "Services Requiring IP Connectivity";
|
systemd.targets.ip-up.description = "Services Requiring IP Connectivity (deprecated)";
|
||||||
|
|
||||||
# This is needed when /etc/resolv.conf is being overriden by networkd
|
# This is needed when /etc/resolv.conf is being overriden by networkd
|
||||||
# and other configurations. If the file is destroyed by an environment
|
# and other configurations. If the file is destroyed by an environment
|
||||||
|
|
|
@ -61,7 +61,9 @@ with lib;
|
||||||
services.avahi.enable = true;
|
services.avahi.enable = true;
|
||||||
|
|
||||||
systemd.services."4store-endpoint" = {
|
systemd.services."4store-endpoint" = {
|
||||||
wantedBy = [ "ip-up.target" ];
|
after = [ "network.target" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
script = ''
|
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}'
|
${run} '${pkgs.rdf4store}/bin/4s-httpd -D ${cfg.options} ${if cfg.listenAddress!=null then "-H ${cfg.listenAddress}" else "" } -p ${toString cfg.port} ${cfg.database}'
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -53,7 +53,8 @@ with lib;
|
||||||
services.avahi.enable = true;
|
services.avahi.enable = true;
|
||||||
|
|
||||||
systemd.services."4store" = {
|
systemd.services."4store" = {
|
||||||
wantedBy = [ "ip-up.target" ];
|
after = [ "network.target" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
preStart = ''
|
preStart = ''
|
||||||
mkdir -p ${stateDir}/
|
mkdir -p ${stateDir}/
|
||||||
|
|
|
@ -62,7 +62,8 @@ with lib;
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.virtuoso = {
|
systemd.services.virtuoso = {
|
||||||
wantedBy = [ "ip-up.target" ];
|
after = [ "network.target" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
preStart = ''
|
preStart = ''
|
||||||
mkdir -p ${stateDir}
|
mkdir -p ${stateDir}
|
||||||
|
|
|
@ -74,7 +74,8 @@ in
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
systemd.services.freepopsd = {
|
systemd.services.freepopsd = {
|
||||||
description = "Freepopsd (webmail over POP3)";
|
description = "Freepopsd (webmail over POP3)";
|
||||||
wantedBy = [ "ip-up.target" ];
|
after = [ "network.target" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
script = ''
|
script = ''
|
||||||
${pkgs.freepops}/bin/freepopsd \
|
${pkgs.freepops}/bin/freepopsd \
|
||||||
-p ${toString cfg.port} \
|
-p ${toString cfg.port} \
|
||||||
|
|
|
@ -182,7 +182,8 @@ in
|
||||||
|
|
||||||
systemd.services.upsmon = {
|
systemd.services.upsmon = {
|
||||||
description = "Uninterruptible Power Supplies (Monitor)";
|
description = "Uninterruptible Power Supplies (Monitor)";
|
||||||
wantedBy = [ "ip-up.target" ];
|
after = [ "network.target" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
serviceConfig.Type = "forking";
|
serviceConfig.Type = "forking";
|
||||||
script = "${pkgs.nut}/sbin/upsmon";
|
script = "${pkgs.nut}/sbin/upsmon";
|
||||||
environment.NUT_CONFPATH = "/etc/nut/";
|
environment.NUT_CONFPATH = "/etc/nut/";
|
||||||
|
@ -191,8 +192,8 @@ in
|
||||||
|
|
||||||
systemd.services.upsd = {
|
systemd.services.upsd = {
|
||||||
description = "Uninterruptible Power Supplies (Daemon)";
|
description = "Uninterruptible Power Supplies (Daemon)";
|
||||||
|
after = [ "network.target" "upsmon.service" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
after = [ "network-interfaces.target" "upsmon.service" ];
|
|
||||||
serviceConfig.Type = "forking";
|
serviceConfig.Type = "forking";
|
||||||
# TODO: replace 'root' by another username.
|
# TODO: replace 'root' by another username.
|
||||||
script = "${pkgs.nut}/sbin/upsd -u root";
|
script = "${pkgs.nut}/sbin/upsd -u root";
|
||||||
|
@ -202,8 +203,8 @@ in
|
||||||
|
|
||||||
systemd.services.upsdrv = {
|
systemd.services.upsdrv = {
|
||||||
description = "Uninterruptible Power Supplies (Register all UPS)";
|
description = "Uninterruptible Power Supplies (Register all UPS)";
|
||||||
wantedBy = [ "multi-user.target" ];
|
|
||||||
after = [ "upsd.service" ];
|
after = [ "upsd.service" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
# TODO: replace 'root' by another username.
|
# TODO: replace 'root' by another username.
|
||||||
script = ''${pkgs.nut}/bin/upsdrvctl -u root start'';
|
script = ''${pkgs.nut}/bin/upsdrvctl -u root start'';
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
|
|
|
@ -53,9 +53,9 @@ let cfg = config.services.drbd; in
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.drbd = {
|
systemd.services.drbd = {
|
||||||
after = [ "systemd-udev.settle.service" ];
|
after = [ "systemd-udev.settle.service" "network.target" ];
|
||||||
wants = [ "systemd-udev.settle.service" ];
|
wants = [ "systemd-udev.settle.service" ];
|
||||||
wantedBy = [ "ip-up.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
script = ''
|
script = ''
|
||||||
${pkgs.drbd}/sbin/drbdadm up all
|
${pkgs.drbd}/sbin/drbdadm up all
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -59,7 +59,8 @@ in
|
||||||
|
|
||||||
systemd.services.amuled = {
|
systemd.services.amuled = {
|
||||||
description = "AMule daemon";
|
description = "AMule daemon";
|
||||||
wantedBy = [ "ip-up.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
after = [ "network.target" ];
|
||||||
|
|
||||||
preStart = ''
|
preStart = ''
|
||||||
mkdir -p ${cfg.dataDir}
|
mkdir -p ${cfg.dataDir}
|
||||||
|
|
|
@ -61,7 +61,6 @@ let
|
||||||
${cfg.extraConfig}
|
${cfg.extraConfig}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Hook for emitting ip-up/ip-down events.
|
|
||||||
exitHook = pkgs.writeText "dhcpcd.exit-hook"
|
exitHook = pkgs.writeText "dhcpcd.exit-hook"
|
||||||
''
|
''
|
||||||
if [ "$reason" = BOUND -o "$reason" = REBOOT ]; then
|
if [ "$reason" = BOUND -o "$reason" = REBOOT ]; then
|
||||||
|
@ -73,14 +72,8 @@ let
|
||||||
# applies to openntpd.
|
# applies to openntpd.
|
||||||
${config.systemd.package}/bin/systemctl try-restart ntpd.service
|
${config.systemd.package}/bin/systemctl try-restart ntpd.service
|
||||||
${config.systemd.package}/bin/systemctl try-restart openntpd.service
|
${config.systemd.package}/bin/systemctl try-restart openntpd.service
|
||||||
|
|
||||||
${config.systemd.package}/bin/systemctl start ip-up.target
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#if [ "$reason" = EXPIRE -o "$reason" = RELEASE -o "$reason" = NOCARRIER ] ; then
|
|
||||||
# ${config.systemd.package}/bin/systemctl start ip-down.target
|
|
||||||
#fi
|
|
||||||
|
|
||||||
${cfg.runHook}
|
${cfg.runHook}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,8 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services."git-daemon" = {
|
systemd.services."git-daemon" = {
|
||||||
wantedBy = [ "ip-up.target" ];
|
after = [ "network.target" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
script = "${pkgs.git}/bin/git daemon --reuseaddr "
|
script = "${pkgs.git}/bin/git daemon --reuseaddr "
|
||||||
+ (optionalString (cfg.basePath != "") "--base-path=${cfg.basePath} ")
|
+ (optionalString (cfg.basePath != "") "--base-path=${cfg.basePath} ")
|
||||||
+ (optionalString (cfg.listenAddress != "") "--listen=${cfg.listenAddress} ")
|
+ (optionalString (cfg.listenAddress != "") "--listen=${cfg.listenAddress} ")
|
||||||
|
|
|
@ -106,7 +106,8 @@ in
|
||||||
createIodineClientService = name: cfg:
|
createIodineClientService = name: cfg:
|
||||||
{
|
{
|
||||||
description = "iodine client - ${name}";
|
description = "iodine client - ${name}";
|
||||||
wantedBy = [ "ip-up.target" ];
|
after = [ "network.target" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
RestartSec = "30s";
|
RestartSec = "30s";
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
|
@ -121,7 +122,8 @@ in
|
||||||
) // {
|
) // {
|
||||||
iodined = mkIf (cfg.server.enable) {
|
iodined = mkIf (cfg.server.enable) {
|
||||||
description = "iodine, ip over dns server daemon";
|
description = "iodine, ip over dns server daemon";
|
||||||
wantedBy = [ "ip-up.target" ];
|
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}";
|
serviceConfig.ExecStart = "${pkgs.iodine}/bin/iodined -f -u ${iodinedUser} ${cfg.server.extraConfig} ${cfg.server.ip} ${cfg.server.domain}";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -55,7 +55,6 @@ let
|
||||||
ipUpScript = writeScript "01nixos-ip-up" ''
|
ipUpScript = writeScript "01nixos-ip-up" ''
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
if test "$2" = "up"; then
|
if test "$2" = "up"; then
|
||||||
${config.systemd.package}/bin/systemctl start ip-up.target
|
|
||||||
${config.systemd.package}/bin/systemctl start network-online.target
|
${config.systemd.package}/bin/systemctl start network-online.target
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -677,8 +677,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.systemd-networkd-wait-online = {
|
systemd.services.systemd-networkd-wait-online = {
|
||||||
before = [ "ip-up.target" ];
|
wantedBy = [ "network-online.target" ];
|
||||||
wantedBy = [ "network-online.target" "ip-up.target" ];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services."systemd-network-wait-online@" = {
|
systemd.services."systemd-network-wait-online@" = {
|
||||||
|
|
|
@ -142,7 +142,7 @@ in
|
||||||
# (Flushing this interface may have removed it.)
|
# (Flushing this interface may have removed it.)
|
||||||
${config.systemd.package}/bin/systemctl try-restart --no-block network-setup.service
|
${config.systemd.package}/bin/systemctl try-restart --no-block network-setup.service
|
||||||
fi
|
fi
|
||||||
${config.systemd.package}/bin/systemctl start ip-up.target
|
${config.systemd.package}/bin/systemctl start network-online.target
|
||||||
'';
|
'';
|
||||||
preStop = flip concatMapStrings (ips) (ip:
|
preStop = flip concatMapStrings (ips) (ip:
|
||||||
let
|
let
|
||||||
|
|
|
@ -178,7 +178,8 @@ in
|
||||||
|
|
||||||
systemd.services.waagent = {
|
systemd.services.waagent = {
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
after = [ "ip-up.target" "sshd.service" ];
|
after = [ "network-online.target" "sshd.service" ];
|
||||||
|
wants = [ "network-online.target" ];
|
||||||
|
|
||||||
path = [ pkgs.e2fsprogs ];
|
path = [ pkgs.e2fsprogs ];
|
||||||
description = "Windows Azure Agent Service";
|
description = "Windows Azure Agent Service";
|
||||||
|
|
|
@ -116,8 +116,8 @@ in
|
||||||
|
|
||||||
wantedBy = [ "multi-user.target" "sshd.service" ];
|
wantedBy = [ "multi-user.target" "sshd.service" ];
|
||||||
before = [ "sshd.service" ];
|
before = [ "sshd.service" ];
|
||||||
wants = [ "ip-up.target" ];
|
wants = [ "network-online.target" ];
|
||||||
after = [ "ip-up.target" ];
|
after = [ "network-online.target" ];
|
||||||
|
|
||||||
path = [ pkgs.wget pkgs.iproute ];
|
path = [ pkgs.wget pkgs.iproute ];
|
||||||
|
|
||||||
|
|
|
@ -134,8 +134,8 @@ in
|
||||||
|
|
||||||
wantedBy = [ "sshd.service" ];
|
wantedBy = [ "sshd.service" ];
|
||||||
before = [ "sshd.service" ];
|
before = [ "sshd.service" ];
|
||||||
after = [ "network-online.target" "ip-up.target" ];
|
after = [ "network-online.target" ];
|
||||||
wants = [ "network-online.target" "ip-up.target" ];
|
wants = [ "network-online.target" ];
|
||||||
|
|
||||||
script = let wget = "${pkgs.wget}/bin/wget --retry-connrefused -t 15 --waitretry=10 --header='Metadata-Flavor: Google'";
|
script = let wget = "${pkgs.wget}/bin/wget --retry-connrefused -t 15 --waitretry=10 --header='Metadata-Flavor: Google'";
|
||||||
mktemp = "mktemp --tmpdir=/run"; in
|
mktemp = "mktemp --tmpdir=/run"; in
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue