Merge pull request #258680 from lf-/jade/remove-multiuser-netonline-dep

nixos/systemd: don't require network-online.target for multi-user.target
This commit is contained in:
Martin Weinelt 2024-01-19 12:49:23 +01:00 committed by GitHub
commit c2853e2588
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
102 changed files with 167 additions and 32 deletions

View file

@ -112,6 +112,13 @@ The pre-existing [services.ankisyncd](#opt-services.ankisyncd.enable) has been m
- `services.avahi.nssmdns` got split into `services.avahi.nssmdns4` and `services.avahi.nssmdns6` which enable the mDNS NSS switch for IPv4 and IPv6 respectively.
Since most mDNS responders only register IPv4 addresses, most users want to keep the IPv6 support disabled to avoid long timeouts.
- `multi-user.target` no longer depends on `network-online.target`.
This will potentially break services that assumed this was the case in the past.
This was changed for consistency with other distributions as well as improved boot times.
We have added a warning for services that are
`after = [ "network-online.target" ]` but do not depend on it (e.g. using `wants`).
- `networking.iproute2.enable` now does not set `environment.etc."iproute2/rt_tables".text`.
Setting `environment.etc."iproute2/{CONFIG_FILE_NAME}".text` will override the whole configuration file instead of appending it to the upstream configuration file.

View file

@ -64,6 +64,7 @@ in
config = mkIf cfg.enable {
systemd = {
services.gmediarender = {
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
description = "gmediarender server daemon";

View file

@ -26,6 +26,7 @@ in
config = mkIf cfg.enable {
systemd.services.jmusicbot = {
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
description = "Discord music bot that's easy to set up and run yourself!";
serviceConfig = mkMerge [{

View file

@ -50,6 +50,7 @@ in
systemd.services.spotifyd = {
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" "sound.target" ];
description = "spotifyd, a Spotify playing daemon";
environment.SHELL = "/bin/sh";

View file

@ -50,6 +50,7 @@ in {
description = "Standalone MPD Web GUI written in C";
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
serviceConfig = {

View file

@ -268,6 +268,7 @@ in {
systemd.services.buildbot-master = {
description = "Buildbot Continuous Integration Server.";
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
path = cfg.packages ++ cfg.pythonPackages python.pkgs;
environment.PYTHONPATH = "${python.withPackages (self: cfg.pythonPackages self ++ [ package ])}/${python.sitePackages}";

View file

@ -188,6 +188,7 @@ in
nameValuePair "gitea-runner-${escapeSystemdPath name}" {
inherit (instance) enable;
description = "Gitea Actions Runner";
wants = [ "network-online.target" ];
after = [
"network-online.target"
] ++ optionals (wantsDocker) [

View file

@ -393,6 +393,7 @@ in
systemd.services.hydra-evaluator =
{ wantedBy = [ "multi-user.target" ];
requires = [ "hydra-init.service" ];
wants = [ "network-online.target" ];
after = [ "hydra-init.service" "network.target" "network-online.target" ];
path = with pkgs; [ hydra-package nettools jq ];
restartTriggers = [ hydraConf ];

View file

@ -104,6 +104,7 @@ in
config = lib.mkIf cfg.enable {
systemd.services.lldap = {
description = "Lightweight LDAP server (lldap)";
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {

View file

@ -294,6 +294,7 @@ in {
"man:slapd-mdb"
];
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
serviceConfig = {
User = cfg.user;

View file

@ -200,6 +200,7 @@ in
};
systemd.services.geoclue = {
wants = lib.optionals cfg.enableWifi [ "network-online.target" ];
after = lib.optionals cfg.enableWifi [ "network-online.target" ];
# restart geoclue service when the configuration changes
restartTriggers = [
@ -217,6 +218,7 @@ in
# we can't be part of a system service, and the agent should
# be okay with the main service coming and going
wantedBy = [ "default.target" ];
wants = lib.optionals cfg.enableWifi [ "network-online.target" ];
after = lib.optionals cfg.enableWifi [ "network-online.target" ];
unitConfig.ConditionUser = "!@system";
serviceConfig = {

View file

@ -41,6 +41,7 @@ in
config = mkIf cfg.enable {
systemd.services.evcc = {
wants = [ "network-online.target" ];
after = [
"network-online.target"
"mosquitto.target"

View file

@ -435,6 +435,7 @@ in {
systemd.services.home-assistant = {
description = "Home Assistant";
wants = [ "network-online.target" ];
after = [
"network-online.target"

View file

@ -84,6 +84,7 @@ in {
systemd.services.journaldriver = {
description = "Stackdriver Logging journal forwarder";
script = "${pkgs.journaldriver}/bin/journaldriver";
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];

View file

@ -250,6 +250,7 @@ in
path = [ config.services.postgresql.package ];
})
{
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
script = let

View file

@ -435,7 +435,7 @@ in
wantedBy = [ "multi-user.target" ];
after = [ "network-online.target" ];
wants = sympaSubServices;
wants = sympaSubServices ++ [ "network-online.target" ];
before = sympaSubServices;
serviceConfig = sympaServiceConfig "sympa_msg";

View file

@ -1056,6 +1056,7 @@ in {
systemd.targets.matrix-synapse = lib.mkIf hasWorkers {
description = "Synapse Matrix parent target";
wants = [ "network-online.target" ];
after = [ "network-online.target" ] ++ optional hasLocalPostgresDB "postgresql.service";
wantedBy = [ "multi-user.target" ];
};
@ -1071,6 +1072,7 @@ in {
requires = optional hasLocalPostgresDB "postgresql.service";
}
else {
wants = [ "network-online.target" ];
after = [ "network-online.target" ] ++ optional hasLocalPostgresDB "postgresql.service";
requires = optional hasLocalPostgresDB "postgresql.service";
wantedBy = [ "multi-user.target" ];

View file

@ -41,6 +41,7 @@ in {
# See https://github.com/aws/amazon-ssm-agent/blob/mainline/packaging/linux/amazon-ssm-agent.service
systemd.services.amazon-ssm-agent = {
inherit (cfg.package.meta) description;
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];

View file

@ -154,7 +154,7 @@ in
in {
description = "BigClown Gateway";
wantedBy = [ "multi-user.target" ];
wants = mkIf config.services.mosquitto.enable [ "mosquitto.service" ];
wants = [ "network-online.target" ] ++ lib.optional config.services.mosquitto.enable "mosquitto.service";
after = [ "network-online.target" ];
preStart = ''
umask 077

View file

@ -35,6 +35,7 @@ in {
systemd.services."domoticz" = {
description = pkgDesc;
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
serviceConfig = {
DynamicUser = true;

View file

@ -59,6 +59,7 @@ in
systemd.services.etesync-dav = {
description = "etesync-dav - A CalDAV and CardDAV adapter for EteSync";
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
path = [ pkgs.etesync-dav ];

View file

@ -357,6 +357,7 @@ in {
description = "${cfg.serverName} media Server";
# Gerbera might fail if the network interface is not available on startup
# https://github.com/gerbera/gerbera/issues/1324
wants = [ "network-online.target" ];
after = [ "network.target" "network-online.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig.ExecStart = "${binaryCommand} --port ${toString cfg.port} ${interfaceFlag} ${configFlag} --home ${cfg.dataDir}";

View file

@ -77,6 +77,7 @@ in {
systemd.services.metabase = {
description = "Metabase server";
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
environment = {
MB_PLUGINS_DIR = "${dataDir}/plugins";

View file

@ -297,6 +297,7 @@ in
wantedBy = [ "paperless-scheduler.service" ];
before = [ "paperless-scheduler.service" ];
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
serviceConfig = defaultServiceConfig // {
User = cfg.user;
Type = "oneshot";

View file

@ -84,6 +84,7 @@ in {
# upstream service file in https://git.io/JUt4Q
systemd.services.mackerel-agent = {
description = "mackerel.io agent";
wants = [ "network-online.target" ];
after = [ "network-online.target" "nss-lookup.target" ];
wantedBy = [ "multi-user.target" ];
environment = {

View file

@ -174,6 +174,7 @@ in {
systemd.services.alertmanager = {
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
preStart = ''
${lib.getBin pkgs.envsubst}/bin/envsubst -o "/tmp/alert-manager-substituted.yaml" \

View file

@ -30,6 +30,7 @@ in
description = "TeamViewer remote control daemon";
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" "network.target" "dbus.service" ];
requires = [ "dbus.service" ];
preStart = "mkdir -pv /var/lib/teamviewer /var/log/teamviewer";

View file

@ -59,6 +59,7 @@ in {
in {
description = "Telegraf Agent";
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
path = lib.optional (config.services.telegraf.extraConfig.inputs ? procstat) pkgs.procps;
serviceConfig = {

View file

@ -215,6 +215,7 @@ in
systemd.services.afsd = {
description = "AFS client";
wantedBy = [ "multi-user.target" ];
wants = lib.optional (!cfg.startDisconnected) "network-online.target";
after = singleton (if cfg.startDisconnected then "network.target" else "network-online.target");
serviceConfig = { RemainAfterExit = true; };
restartIfChanged = false;

View file

@ -198,6 +198,7 @@ in
'';
in {
description = "Bitcoin daemon";
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {

View file

@ -47,6 +47,7 @@ in
systemd.services.dante = {
description = "Dante SOCKS v4 and v5 compatible proxy server";
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];

View file

@ -114,6 +114,7 @@ in {
systemd.services.ergo = {
description = "ergo server";
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
serviceConfig = {
User = cfg.user;

View file

@ -21,6 +21,7 @@ with lib;
RestartSec = 5;
};
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network.target" "network-online.target" ];
};
};

View file

@ -460,6 +460,7 @@ in {
systemd.services.headscale = {
description = "headscale coordination server for Tailscale";
wants = [ "network-online.target" ];
after = ["network-online.target"];
wantedBy = ["multi-user.target"];
restartTriggers = [configFile];

View file

@ -125,7 +125,8 @@ in
systemd.services.ircd-hybrid = {
description = "IRCD Hybrid server";
after = [ "started networking" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
script = "${ircdService}/bin/control start";
};

View file

@ -27,7 +27,7 @@ with lib;
systemd.services.ivpn-service = {
description = "iVPN daemon";
wantedBy = [ "multi-user.target" ];
wants = [ "network.target" ];
wants = [ "network.target" "network-online.target" ];
after = [
"network-online.target"
"NetworkManager.service"

View file

@ -325,6 +325,9 @@ in
"network-online.target"
"time-sync.target"
];
wants = [
"network-online.target"
];
wantedBy = [
"multi-user.target"
];
@ -372,6 +375,9 @@ in
"network-online.target"
"time-sync.target"
];
wants = [
"network-online.target"
];
wantedBy = [
"multi-user.target"
];
@ -413,6 +419,7 @@ in
"https://kea.readthedocs.io/en/kea-${package.version}/arm/ddns.html"
];
wants = [ "network-online.target" ];
after = [
"network-online.target"
"time-sync.target"

View file

@ -596,6 +596,7 @@ in
systemd.services.mosquitto = {
description = "Mosquitto MQTT Broker Daemon";
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
serviceConfig = {
Type = "notify";

View file

@ -53,7 +53,7 @@ with lib;
systemd.services.mullvad-daemon = {
description = "Mullvad VPN daemon";
wantedBy = [ "multi-user.target" ];
wants = [ "network.target" ];
wants = [ "network.target" "network-online.target" ];
after = [
"network-online.target"
"NetworkManager.service"

View file

@ -117,6 +117,7 @@ in
boot.kernelModules = [ "nbd" ];
systemd.services.nbd-server = {
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
before = [ "multi-user.target" ];
wantedBy = [ "multi-user.target" ];

View file

@ -85,6 +85,7 @@ in
systemd.services.ocserv = {
description = "OpenConnect SSL VPN server";
documentation = [ "man:ocserv(8)" ];
wants = [ "network-online.target" ];
after = [ "dbus.service" "network-online.target" ];
wantedBy = [ "multi-user.target" ];

View file

@ -92,6 +92,7 @@ in {
systemd.services.pleroma = {
description = "Pleroma social network";
wants = [ "network-online.target" ];
after = [ "network-online.target" "postgresql.service" ];
wantedBy = [ "multi-user.target" ];
restartTriggers = [ config.environment.etc."/pleroma/config.exs".source ];

View file

@ -208,6 +208,7 @@ in
in
rec {
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
path = [ cfg.package pkgs.wireguard-tools ];

View file

@ -33,7 +33,7 @@ in {
wantedBy = [ "multi-user.target" ];
after = [ "systemd-modules-load.service" "network-online.target" ];
wants = [ "network-pre.target" ];
wants = [ "network-pre.target" "network-online.target" ];
serviceConfig = {
Type = "oneshot";

View file

@ -110,6 +110,7 @@ in
systemd.services.soju = {
description = "soju IRC bouncer";
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
serviceConfig = {
DynamicUser = true;

View file

@ -55,6 +55,7 @@ in {
systemd.services.strongswan-swanctl = {
description = "strongSwan IPsec IKEv1/IKEv2 daemon using swanctl";
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
path = with pkgs; [ kmod iproute2 iptables util-linux ];
environment = {

View file

@ -153,6 +153,7 @@ in
description = "strongSwan IPSec Service";
wantedBy = [ "multi-user.target" ];
path = with pkgs; [ kmod iproute2 iptables util-linux ]; # XXX Linux
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
environment = {
STRONGSWAN_CONF = strongswanConf { inherit setup connections ca secretsFile managePlugins enabledPlugins; };

View file

@ -107,6 +107,7 @@ in
systemd.services.syncplay = {
description = "Syncplay Service";
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
serviceConfig = {

View file

@ -119,6 +119,7 @@ in {
systemd.services.wasabibackend = {
description = "wasabibackend server";
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
environment = {
DOTNET_PRINT_TELEMETRY_MESSAGE = "false";

View file

@ -243,6 +243,7 @@ in
systemd.services.znc = {
description = "ZNC Server";
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
serviceConfig = {
User = cfg.user;

View file

@ -182,6 +182,7 @@ in
systemd.services.certmgr = {
description = "certmgr";
path = mkIf (cfg.svcManager == "command") [ pkgs.bash ];
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
inherit preStart;

View file

@ -572,6 +572,7 @@ in
description = "OAuth2 Proxy";
path = [ cfg.package ];
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
serviceConfig = {

View file

@ -49,6 +49,7 @@ in {
config = mkIf cfg.enable {
systemd.services.cachix-agent = {
description = "Cachix Deploy Agent";
wants = [ "network-online.target" ];
after = ["network-online.target"];
path = [ config.nix.package ];
wantedBy = [ "multi-user.target" ];

View file

@ -61,6 +61,7 @@ in
config = mkIf cfg.enable {
systemd.services.cachix-watch-store-agent = {
description = "Cachix watch store Agent";
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
path = [ config.nix.package ];
wantedBy = [ "multi-user.target" ];

View file

@ -94,6 +94,7 @@ in
config = lib.mkIf cfg.enable {
systemd.services.go2rtc = {
wants = [ "network-online.target" ];
after = [
"network-online.target"
];

View file

@ -974,7 +974,7 @@ in {
# This service depends on network-online.target and is sequenced after
# it because it requires access to the Internet to function properly.
bindsTo = [ "akkoma-config.service" ];
wants = [ "network-online.service" ];
wants = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
after = [
"akkoma-config.target"

View file

@ -94,6 +94,7 @@ in {
description = "alps is a simple and extensible webmail.";
documentation = [ "https://git.sr.ht/~migadu/alps" ];
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network.target" "network-online.target" ];
serviceConfig = {

View file

@ -80,6 +80,7 @@ in {
description = "c2FmZQ-server";
documentation = [ "https://github.com/c2FmZQ/c2FmZQ/blob/main/README.md" ];
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network.target" "network-online.target" ];
serviceConfig = {

View file

@ -205,6 +205,7 @@ in {
systemd.services.code-server = {
description = "Code server";
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
path = cfg.extraPackages;
environment = {

View file

@ -176,6 +176,7 @@ in
systemd.targets.healthchecks = {
description = "Target for all Healthchecks services";
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network.target" "network-online.target" ];
};

View file

@ -267,6 +267,7 @@ in {
systemd.targets.netbox = {
description = "Target for all NetBox services";
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" "redis-netbox.service" ];
};

View file

@ -159,6 +159,7 @@ in
systemd.services.openvscode-server = {
description = "OpenVSCode server";
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
path = cfg.extraPackages;
environment = cfg.extraEnvironment;

View file

@ -196,6 +196,7 @@ in {
systemd.targets.peering-manager = {
description = "Target for all Peering Manager services";
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" "redis-peering-manager.service" ];
};

View file

@ -71,6 +71,7 @@ in
systemd.services.agate = {
description = "Agate";
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network.target" "network-online.target" ];
script =

View file

@ -101,6 +101,7 @@ in {
];
systemd.services.mighttpd2 = {
description = "Mighttpd2 web server";
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {

View file

@ -98,6 +98,7 @@ in
services.minio = {
description = "Minio Object Storage";
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {

View file

@ -144,6 +144,7 @@ in {
systemd.services.traefik = {
description = "Traefik web server";
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
startLimitIntervalSec = 86400;

View file

@ -451,20 +451,37 @@ in
cfg.services
);
assertions = concatLists (
mapAttrsToList
(name: service:
map (message: {
assertion = false;
inherit message;
}) (concatLists [
(optional ((builtins.elem "network-interfaces.target" service.after) || (builtins.elem "network-interfaces.target" service.wants))
"Service '${name}.service' is using the deprecated target network-interfaces.target, which no longer exists. Using network.target is recommended instead."
)
])
)
cfg.services
);
assertions = let
mkOneAssert = typeStr: name: def: {
assertion = lib.elem "network-online.target" def.after -> lib.elem "network-online.target" (def.wants ++ def.requires ++ def.bindsTo);
message = "${name}.${typeStr} is ordered after 'network-online.target' but doesn't depend on it";
};
mkAsserts = typeStr: lib.mapAttrsToList (mkOneAssert typeStr);
mkMountAsserts = typeStr: map (m: mkOneAssert typeStr m.what m);
in mkMerge [
(concatLists (
mapAttrsToList
(name: service:
map (message: {
assertion = false;
inherit message;
}) (concatLists [
(optional ((builtins.elem "network-interfaces.target" service.after) || (builtins.elem "network-interfaces.target" service.wants))
"Service '${name}.service' is using the deprecated target network-interfaces.target, which no longer exists. Using network.target is recommended instead."
)
])
)
cfg.services
))
(mkAsserts "target" cfg.targets)
(mkAsserts "service" cfg.services)
(mkAsserts "socket" cfg.sockets)
(mkAsserts "timer" cfg.timers)
(mkAsserts "path" cfg.paths)
(mkMountAsserts "mount" cfg.mounts)
(mkMountAsserts "automount" cfg.automounts)
(mkAsserts "slice" cfg.slices)
];
system.build.units = cfg.units;
@ -641,7 +658,6 @@ in
systemd.services.systemd-udev-settle.restartIfChanged = false; # Causes long delays in nixos-rebuild
systemd.targets.local-fs.unitConfig.X-StopOnReconfiguration = true;
systemd.targets.remote-fs.unitConfig.X-StopOnReconfiguration = true;
systemd.targets.network-online.wantedBy = [ "multi-user.target" ];
systemd.services.systemd-importd.environment = proxy_env;
systemd.services.systemd-pstore.wantedBy = [ "sysinit.target" ]; # see #81138

View file

@ -71,6 +71,7 @@ in
systemd.services.fetch-ec2-metadata = {
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = ["network-online.target"];
path = [ pkgs.curl ];
script = builtins.readFile ./ec2-metadata-fetcher.sh;

View file

@ -267,6 +267,7 @@ let
};
in {
wantedBy = [] ++ optional (container.autoStart) "multi-user.target";
wants = lib.optional (container.imageFile == null) "network-online.target";
after = lib.optionals (cfg.backend == "docker") [ "docker.service" "docker.socket" ]
# if imageFile is not set, the service needs the network to download the image from the registry
++ lib.optionals (container.imageFile == null) [ "network-online.target" ]

View file

@ -134,6 +134,7 @@
testScript = ''
start_all()
peer0.systemctl("start network-online.target")
peer0.wait_for_unit("network-online.target")
peer1.wait_for_unit("3proxy.service")

View file

@ -522,6 +522,7 @@ in {
'curl --data \'{"host": "${caDomain}", "addresses": ["${nodes.acme.networking.primaryIPAddress}"]}\' http://${dnsServerIP nodes}:8055/add-a'
)
acme.systemctl("start network-online.target")
acme.wait_for_unit("network-online.target")
acme.wait_for_unit("pebble.service")

View file

@ -126,6 +126,7 @@
with subtest("Testing successful DHCP start"):
dhcpConf.wait_for_unit("adguardhome.service")
client.systemctl("start network-online.target")
client.wait_for_unit("network-online.target")
# Test IP assignment via DHCP
dhcpConf.wait_until_succeeds("ping -c 5 10.0.10.100")

View file

@ -120,10 +120,6 @@ import ./make-test-python.nix ({ pkgs, lib, ...} : {
''
start_all()
client.wait_for_unit("network-online.target")
local_router.wait_for_unit("network-online.target")
remote_router.wait_for_unit("network-online.target")
local_router.wait_for_unit("babeld.service")
remote_router.wait_for_unit("babeld.service")

View file

@ -115,6 +115,7 @@ in
start_all()
# Wait for network and miniupnpd.
router.systemctl("start network-online.target")
router.wait_for_unit("network-online.target")
router.wait_for_unit("miniupnpd")
@ -129,6 +130,7 @@ in
tracker.succeed("chmod 644 /tmp/test.torrent")
# Start the tracker. !!! use a less crappy tracker
tracker.systemctl("start network-online.target")
tracker.wait_for_unit("network-online.target")
tracker.wait_for_unit("opentracker.service")
tracker.wait_for_open_port(6969)
@ -140,6 +142,7 @@ in
# Now we should be able to download from the client behind the NAT.
tracker.wait_for_unit("httpd")
client1.systemctl("start network-online.target")
client1.wait_for_unit("network-online.target")
client1.succeed("transmission-remote --add http://${externalTrackerAddress}/test.torrent >&2 &")
client1.wait_for_file("${download-dir}/test.tar.bz2")
@ -152,6 +155,7 @@ in
# Now download from the second client. This can only succeed if
# the first client created a NAT hole in the router.
client2.systemctl("start network-online.target")
client2.wait_for_unit("network-online.target")
client2.succeed(
"transmission-remote --add http://${externalTrackerAddress}/test.torrent --no-portmap --no-dht >&2 &"

View file

@ -71,6 +71,7 @@ import ./make-test-python.nix ({ pkgs, ... }: {
gitrepo.wait_for_unit("multi-user.target")
with subtest("Repo is accessible via git daemon"):
bbmaster.systemctl("start network-online.target")
bbmaster.wait_for_unit("network-online.target")
bbmaster.succeed("rm -rfv /tmp/fakerepo")
bbmaster.succeed("git clone git://gitrepo/fakerepo /tmp/fakerepo")
@ -78,6 +79,7 @@ import ./make-test-python.nix ({ pkgs, ... }: {
with subtest("Master service and worker successfully connect"):
bbmaster.wait_for_unit("buildbot-master.service")
bbmaster.wait_until_succeeds("curl --fail -s --head http://bbmaster:8010")
bbworker.systemctl("start network-online.target")
bbworker.wait_for_unit("network-online.target")
bbworker.succeed("nc -z bbmaster 8010")
bbworker.succeed("nc -z bbmaster 9989")

View file

@ -56,6 +56,8 @@ import ./make-test-python.nix (
with subtest("Wait for CoreRAD and network ready"):
# Ensure networking is online and CoreRAD is ready.
router.systemctl("start network-online.target")
client.systemctl("start network-online.target")
router.wait_for_unit("network-online.target")
client.wait_for_unit("network-online.target")
router.wait_for_unit("corerad.service")

View file

@ -144,6 +144,8 @@ in {
start_all()
with subtest("Wait for network"):
web.systemctl("start network-online.target")
curl.systemctl("start network-online.target")
web.wait_for_unit("network-online.target")
curl.wait_for_unit("network-online.target")

View file

@ -55,6 +55,8 @@ import ./make-test-python.nix ({ pkgs, ...} : {
''
start_all()
client.systemctl("start network-online.target")
server.systemctl("start network-online.target")
client.wait_for_unit("network-online.target")
server.wait_for_unit("network-online.target")
server.wait_for_unit("ferm.service")

View file

@ -59,6 +59,9 @@ in {
with subtest("git daemon starts"):
server.wait_for_unit("git-daemon.service")
server.systemctl("start network-online.target")
client.systemctl("start network-online.target")
server.wait_for_unit("network-online.target")
client.wait_for_unit("network-online.target")

View file

@ -80,6 +80,7 @@ in {
# Now it's the client turn to make use of it.
substitute_server = "http://server.local:${toString publishPort}"
client.systemctl("start network-online.target")
client.wait_for_unit("network-online.target")
response = client.succeed(f"curl {substitute_server}")
assert "Guix Substitute Server" in response

View file

@ -34,6 +34,7 @@ let
machine = ${hostName}
machine.systemctl("start network-online.target")
machine.wait_for_unit("network-online.target")
# Test if NixOS computes the correct FQDN (either a FQDN or an error/null):

View file

@ -158,7 +158,9 @@ let
start_all()
${optionalString clevisTest ''
tang.wait_for_unit("sockets.target")
tang.systemctl("start network-online.target")
tang.wait_for_unit("network-online.target")
machine.systemctl("start network-online.target")
machine.wait_for_unit("network-online.target")
''}
machine.wait_for_unit("multi-user.target")
@ -187,6 +189,7 @@ let
${optionalString clevisTest ''
with subtest("Create the Clevis secret with Tang"):
machine.systemctl("start network-online.target")
machine.wait_for_unit("network-online.target")
machine.succeed('echo -n password | clevis encrypt sss \'{"t": 2, "pins": {"tpm2": {}, "tang": {"url": "http://192.168.1.2"}}}\' -y > /mnt/etc/nixos/clevis-secret.jwe')''}

View file

@ -67,6 +67,7 @@ import ./make-test-python.nix ({ pkgs, ... }:
''
start_all()
server.wait_for_unit("kanidm.service")
client.systemctl("start network-online.target")
client.wait_for_unit("network-online.target")
with subtest("Test HTTP interface"):

View file

@ -59,6 +59,7 @@ in
server.succeed("curl --fail localhost:${toString uiPort}")
with subtest("Lemmy-UI responds through the caddy reverse proxy"):
server.systemctl("start network-online.target")
server.wait_for_unit("network-online.target")
server.wait_for_unit("caddy.service")
server.wait_for_open_port(80)
@ -66,6 +67,7 @@ in
assert "Lemmy" in body, f"String Lemmy not found in response for ${lemmyNodeName}: \n{body}"
with subtest("the server is exposed externally"):
client.systemctl("start network-online.target")
client.wait_for_unit("network-online.target")
client.succeed("curl -v --fail ${lemmyNodeName}")

View file

@ -130,6 +130,7 @@ let
start_all()
client.wait_for_unit("network.target")
router.systemctl("start network-online.target")
router.wait_for_unit("network-online.target")
with subtest("Make sure DHCP server is not started"):
@ -222,6 +223,7 @@ let
start_all()
client.wait_for_unit("network.target")
router.systemctl("start network-online.target")
router.wait_for_unit("network-online.target")
with subtest("Wait until we have an ip address on each interface"):
@ -849,6 +851,7 @@ let
client.wait_for_unit("network.target")
client_with_privacy.wait_for_unit("network.target")
router.systemctl("start network-online.target")
router.wait_for_unit("network-online.target")
with subtest("Wait until we have an ip address"):

View file

@ -105,6 +105,7 @@ in
server.wait_for_unit("rpc-gssd.service")
server.wait_for_unit("rpc-svcgssd.service")
client.systemctl("start network-online.target")
client.wait_for_unit("network-online.target")
# add principals to client keytab

View file

@ -119,6 +119,7 @@ import ./make-test-python.nix {
testScript = ''
start_all()
client.systemctl("start network-online.target")
client.wait_for_unit("network-online.target")
smtp1.wait_for_unit("opensmtpd")
smtp2.wait_for_unit("opensmtpd")

View file

@ -104,6 +104,7 @@ import ./make-test-python.nix {
testScript = ''
start_all()
client.systemctl("start network-online.target")
client.wait_for_unit("network-online.target")
smtp1.wait_for_unit("opensmtpd")
smtp2.wait_for_unit("opensmtpd")

View file

@ -31,6 +31,8 @@ import ./make-test-python.nix ({ pkgs, ... }: {
testScript = ''
start_all()
client.systemctl("start network-online.target")
server.systemctl("start network-online.target")
client.wait_for_unit("network-online.target")
server.wait_for_unit("network-online.target")
server.wait_for_unit("owncast.service")

View file

@ -21,6 +21,8 @@ import ./make-test-python.nix ({
else:
start_all()
unrestricted.systemctl("start network-online.target")
restricted.systemctl("start network-online.target")
unrestricted.wait_for_unit("network-online.target")
restricted.wait_for_unit("network-online.target")

View file

@ -55,6 +55,7 @@ import ./make-test-python.nix {
testScript = ''
start_all()
server.systemctl("start network-online.target")
server.wait_for_unit("network-online.target")
server.wait_for_unit("opensmtpd")
server.wait_for_unit("dovecot2")

View file

@ -70,6 +70,7 @@ import ./make-test-python.nix (
${serverName}.succeed("${pkgs.ssh-audit}/bin/ssh-audit 127.0.0.1")
# Wait for client to be able to connect to the server
${clientName}.systemctl("start network-online.target")
${clientName}.wait_for_unit("network-online.target")
# Set up trusted private key

View file

@ -101,6 +101,9 @@ import ./make-test-python.nix ({pkgs, ...}: {
};
testScript = { ... }: ''
start_all()
router.systemctl("start network-online.target")
client.systemctl("start network-online.target")
router.wait_for_unit("systemd-networkd-wait-online.service")
client.wait_for_unit("systemd-networkd-wait-online.service")
client.wait_until_succeeds("ping -c 5 10.0.2.1")

View file

@ -263,9 +263,6 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: {
};
};
};
# make the network-online target a requirement, we wait for it in our test script
systemd.targets.network-online.wantedBy = [ "multi-user.target" ];
};
# This is the client behind the router. We should be receiving router
@ -278,9 +275,6 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: {
useNetworkd = true;
useDHCP = false;
};
# make the network-online target a requirement, we wait for it in our test script
systemd.targets.network-online.wantedBy = [ "multi-user.target" ];
};
};
@ -294,6 +288,7 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: {
# Since we only care about IPv6 that should not involve waiting for legacy
# IP leases.
client.start()
client.systemctl("start network-online.target")
client.wait_for_unit("network-online.target")
# the static address on the router should not be reachable
@ -312,6 +307,7 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: {
isp.wait_for_unit("multi-user.target")
# wait until the uplink interface has a good status
router.systemctl("start network-online.target")
router.wait_for_unit("network-online.target")
router.wait_until_succeeds("ping -6 -c1 2001:DB8::1")

View file

@ -38,6 +38,7 @@ in {
start_all()
server.wait_for_unit("nginx.service")
client.systemctl("start network-online.target")
client.wait_for_unit("network-online.target")
client.succeed("machinectl pull-raw --verify=signature http://server/testimage.raw")
client.succeed(

View file

@ -206,6 +206,7 @@ import ./make-test-python.nix ({ pkgs, lib, ... }:
testScript = ''
# start client and server
for machine in client, server:
machine.systemctl("start network-online.target")
machine.wait_for_unit("network-online.target")
machine.log(machine.execute("ip addr")[1])
machine.log(machine.execute("ip route")[1])
@ -214,6 +215,7 @@ import ./make-test-python.nix ({ pkgs, lib, ... }:
# test systemd-networkd and nixos-scripts based router
for router in router_systemd, router_nixos:
router.start()
router.systemctl("start network-online.target")
router.wait_for_unit("network-online.target")
router.wait_for_unit("tayga.service")
router.log(machine.execute("ip addr")[1])

View file

@ -104,6 +104,7 @@ import ./make-test-python.nix ({ pkgs, ... }: {
ats.wait_for_open_port(80)
httpbin.wait_for_unit("httpbin")
httpbin.wait_for_open_port(80)
client.systemctl("start network-online.target")
client.wait_for_unit("network-online.target")
with subtest("Traffic Server is running"):

View file

@ -1,5 +1,6 @@
start_all()
machine.wait_for_unit("ulogd.service")
machine.systemctl("start network-online.target")
machine.wait_for_unit("network-online.target")
with subtest("Ulogd is running"):

View file

@ -81,11 +81,13 @@ in
start_all()
# Wait for network and miniupnpd.
router.systemctl("start network-online.target")
router.wait_for_unit("network-online.target")
# $router.wait_for_unit("nat")
router.wait_for_unit("${if useNftables then "nftables" else "firewall"}.service")
router.wait_for_unit("miniupnpd")
client1.systemctl("start network-online.target")
client1.wait_for_unit("network-online.target")
client1.succeed("upnpc -a ${internalClient1Address} 9000 9000 TCP")

Some files were not shown because too many files have changed in this diff Show more