From d7d1d4ad6d8574b6f963d5273d6c9eb67c62d44f Mon Sep 17 00:00:00 2001 From: Will Fancher Date: Thu, 25 Jan 2024 14:23:56 -0500 Subject: [PATCH] Revert "Merge pull request #258680 from lf-/jade/remove-multiuser-netonline-dep" This reverts commit c2853e2588b6f45279884740ef8bc4fe77a633f3, reversing changes made to a23739720fa92858314e72134853b35aa548ce40. There were several modules, critically including NetworkManager, which were not prepared for this change. Revert until those are all fixed. --- .../manual/release-notes/rl-2405.section.md | 7 --- nixos/modules/services/audio/gmediarender.nix | 1 - nixos/modules/services/audio/jmusicbot.nix | 1 - nixos/modules/services/audio/spotifyd.nix | 1 - nixos/modules/services/audio/ympd.nix | 1 - .../gitea-actions-runner.nix | 1 - .../continuous-integration/hydra/default.nix | 1 - nixos/modules/services/databases/lldap.nix | 1 - nixos/modules/services/databases/openldap.nix | 1 - nixos/modules/services/desktops/geoclue2.nix | 2 - .../modules/services/home-automation/evcc.nix | 1 - .../home-automation/home-assistant.nix | 1 - .../services/logging/journaldriver.nix | 1 - nixos/modules/services/mail/roundcube.nix | 1 - nixos/modules/services/mail/sympa.nix | 2 +- nixos/modules/services/matrix/synapse.nix | 2 - .../services/misc/amazon-ssm-agent.nix | 1 - nixos/modules/services/misc/bcg.nix | 2 +- nixos/modules/services/misc/domoticz.nix | 1 - nixos/modules/services/misc/etesync-dav.nix | 1 - nixos/modules/services/misc/mediatomb.nix | 1 - nixos/modules/services/misc/metabase.nix | 1 - nixos/modules/services/misc/paperless.nix | 1 - .../services/monitoring/mackerel-agent.nix | 1 - .../monitoring/prometheus/alertmanager.nix | 1 - .../services/monitoring/teamviewer.nix | 1 - .../modules/services/monitoring/telegraf.nix | 1 - .../network-filesystems/openafs/client.nix | 1 - .../modules/services/networking/bitcoind.nix | 1 - nixos/modules/services/networking/dante.nix | 1 - nixos/modules/services/networking/ergo.nix | 1 - .../services/networking/expressvpn.nix | 1 - .../modules/services/networking/headscale.nix | 1 - .../networking/ircd-hybrid/default.nix | 3 +- nixos/modules/services/networking/ivpn.nix | 2 +- nixos/modules/services/networking/kea.nix | 7 --- .../modules/services/networking/mosquitto.nix | 1 - .../services/networking/mullvad-vpn.nix | 2 +- nixos/modules/services/networking/nbd.nix | 1 - nixos/modules/services/networking/ocserv.nix | 1 - nixos/modules/services/networking/pleroma.nix | 1 - .../modules/services/networking/rosenpass.nix | 1 - nixos/modules/services/networking/rxe.nix | 2 +- nixos/modules/services/networking/soju.nix | 1 - .../networking/strongswan-swanctl/module.nix | 1 - .../services/networking/strongswan.nix | 1 - .../modules/services/networking/syncplay.nix | 1 - .../services/networking/wasabibackend.nix | 1 - .../services/networking/znc/default.nix | 1 - nixos/modules/services/security/certmgr.nix | 1 - .../services/security/oauth2_proxy.nix | 1 - .../services/system/cachix-agent/default.nix | 1 - .../services/system/cachix-watch-store.nix | 1 - .../modules/services/video/go2rtc/default.nix | 1 - nixos/modules/services/web-apps/akkoma.nix | 2 +- nixos/modules/services/web-apps/alps.nix | 1 - .../services/web-apps/c2fmzq-server.nix | 1 - .../modules/services/web-apps/code-server.nix | 1 - .../services/web-apps/healthchecks.nix | 1 - nixos/modules/services/web-apps/netbox.nix | 1 - .../services/web-apps/openvscode-server.nix | 1 - .../services/web-apps/peering-manager.nix | 1 - nixos/modules/services/web-servers/agate.nix | 1 - .../services/web-servers/mighttpd2.nix | 1 - nixos/modules/services/web-servers/minio.nix | 1 - .../modules/services/web-servers/traefik.nix | 1 - nixos/modules/system/boot/systemd.nix | 46 ++++++------------- nixos/modules/virtualisation/amazon-image.nix | 1 - .../modules/virtualisation/oci-containers.nix | 1 - nixos/tests/3proxy.nix | 1 - nixos/tests/acme.nix | 1 - nixos/tests/adguardhome.nix | 1 - nixos/tests/babeld.nix | 4 ++ nixos/tests/bittorrent.nix | 4 -- nixos/tests/buildbot.nix | 2 - nixos/tests/corerad.nix | 2 - nixos/tests/curl-impersonate.nix | 2 - nixos/tests/ferm.nix | 2 - nixos/tests/gitdaemon.nix | 3 -- nixos/tests/guix/publish.nix | 1 - nixos/tests/hostname.nix | 1 - nixos/tests/installer.nix | 3 -- nixos/tests/kanidm.nix | 1 - nixos/tests/lemmy.nix | 2 - nixos/tests/networking.nix | 3 -- nixos/tests/nfs/kerberos.nix | 1 - nixos/tests/opensmtpd-rspamd.nix | 1 - nixos/tests/opensmtpd.nix | 1 - nixos/tests/owncast.nix | 2 - nixos/tests/qemu-vm-restrictnetwork.nix | 2 - nixos/tests/rss2email.nix | 1 - nixos/tests/ssh-audit.nix | 1 - nixos/tests/systemd-networkd-dhcpserver.nix | 3 -- ...ystemd-networkd-ipv6-prefix-delegation.nix | 8 +++- nixos/tests/systemd-nspawn.nix | 1 - nixos/tests/tayga.nix | 2 - nixos/tests/trafficserver.nix | 1 - nixos/tests/ulogd/ulogd.py | 1 - nixos/tests/upnp.nix | 2 - nixos/tests/uptermd.nix | 1 - nixos/tests/zrepl.nix | 1 - 101 files changed, 32 insertions(+), 166 deletions(-) diff --git a/nixos/doc/manual/release-notes/rl-2405.section.md b/nixos/doc/manual/release-notes/rl-2405.section.md index d5fafcf44706c1b..dc2ad5f148b6bd4 100644 --- a/nixos/doc/manual/release-notes/rl-2405.section.md +++ b/nixos/doc/manual/release-notes/rl-2405.section.md @@ -138,13 +138,6 @@ 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`). - - `services.archisteamfarm` no longer uses the abbreviation `asf` for its state directory (`/var/lib/asf`), user and group (both `asf`). Instead the long name `archisteamfarm` is used. Configurations with `system.stateVersion` 23.11 or earlier, default to the old stateDirectory until the 24.11 release and must either set the option explicitly or move the data to the new directory. diff --git a/nixos/modules/services/audio/gmediarender.nix b/nixos/modules/services/audio/gmediarender.nix index a4cb89098db7ad8..545f2b1a2b60db2 100644 --- a/nixos/modules/services/audio/gmediarender.nix +++ b/nixos/modules/services/audio/gmediarender.nix @@ -64,7 +64,6 @@ in config = mkIf cfg.enable { systemd = { services.gmediarender = { - wants = [ "network-online.target" ]; after = [ "network-online.target" ]; wantedBy = [ "multi-user.target" ]; description = "gmediarender server daemon"; diff --git a/nixos/modules/services/audio/jmusicbot.nix b/nixos/modules/services/audio/jmusicbot.nix index e7803677d0fd9d1..fd1d4da19284300 100644 --- a/nixos/modules/services/audio/jmusicbot.nix +++ b/nixos/modules/services/audio/jmusicbot.nix @@ -26,7 +26,6 @@ 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 [{ diff --git a/nixos/modules/services/audio/spotifyd.nix b/nixos/modules/services/audio/spotifyd.nix index 1194b6f200d7012..975be5a87cba9b5 100644 --- a/nixos/modules/services/audio/spotifyd.nix +++ b/nixos/modules/services/audio/spotifyd.nix @@ -50,7 +50,6 @@ 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"; diff --git a/nixos/modules/services/audio/ympd.nix b/nixos/modules/services/audio/ympd.nix index 6e8d22dab3c80e5..b74cc3f9c0b41f6 100644 --- a/nixos/modules/services/audio/ympd.nix +++ b/nixos/modules/services/audio/ympd.nix @@ -50,7 +50,6 @@ in { description = "Standalone MPD Web GUI written in C"; wantedBy = [ "multi-user.target" ]; - wants = [ "network-online.target" ]; after = [ "network-online.target" ]; serviceConfig = { diff --git a/nixos/modules/services/continuous-integration/gitea-actions-runner.nix b/nixos/modules/services/continuous-integration/gitea-actions-runner.nix index 06f0da3451a6c17..3f2be9464849f5a 100644 --- a/nixos/modules/services/continuous-integration/gitea-actions-runner.nix +++ b/nixos/modules/services/continuous-integration/gitea-actions-runner.nix @@ -188,7 +188,6 @@ in nameValuePair "gitea-runner-${escapeSystemdPath name}" { inherit (instance) enable; description = "Gitea Actions Runner"; - wants = [ "network-online.target" ]; after = [ "network-online.target" ] ++ optionals (wantsDocker) [ diff --git a/nixos/modules/services/continuous-integration/hydra/default.nix b/nixos/modules/services/continuous-integration/hydra/default.nix index 54bbe69703f956d..46b03bba37be7bd 100644 --- a/nixos/modules/services/continuous-integration/hydra/default.nix +++ b/nixos/modules/services/continuous-integration/hydra/default.nix @@ -393,7 +393,6 @@ 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 ]; diff --git a/nixos/modules/services/databases/lldap.nix b/nixos/modules/services/databases/lldap.nix index e821da8e58aa3f0..d1574c98fe67f24 100644 --- a/nixos/modules/services/databases/lldap.nix +++ b/nixos/modules/services/databases/lldap.nix @@ -104,7 +104,6 @@ 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 = { diff --git a/nixos/modules/services/databases/openldap.nix b/nixos/modules/services/databases/openldap.nix index df36e37976a4488..a7a0909f55e1b96 100644 --- a/nixos/modules/services/databases/openldap.nix +++ b/nixos/modules/services/databases/openldap.nix @@ -294,7 +294,6 @@ in { "man:slapd-mdb" ]; wantedBy = [ "multi-user.target" ]; - wants = [ "network-online.target" ]; after = [ "network-online.target" ]; serviceConfig = { User = cfg.user; diff --git a/nixos/modules/services/desktops/geoclue2.nix b/nixos/modules/services/desktops/geoclue2.nix index 2a68bb0b55f3a02..b04f46c26a568d9 100644 --- a/nixos/modules/services/desktops/geoclue2.nix +++ b/nixos/modules/services/desktops/geoclue2.nix @@ -200,7 +200,6 @@ 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 = [ @@ -218,7 +217,6 @@ 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 = { diff --git a/nixos/modules/services/home-automation/evcc.nix b/nixos/modules/services/home-automation/evcc.nix index f360f525b04b94a..d0ce3fb4a1ce681 100644 --- a/nixos/modules/services/home-automation/evcc.nix +++ b/nixos/modules/services/home-automation/evcc.nix @@ -41,7 +41,6 @@ in config = mkIf cfg.enable { systemd.services.evcc = { - wants = [ "network-online.target" ]; after = [ "network-online.target" "mosquitto.target" diff --git a/nixos/modules/services/home-automation/home-assistant.nix b/nixos/modules/services/home-automation/home-assistant.nix index a01628968966e89..bc470576b759b2e 100644 --- a/nixos/modules/services/home-automation/home-assistant.nix +++ b/nixos/modules/services/home-automation/home-assistant.nix @@ -435,7 +435,6 @@ in { systemd.services.home-assistant = { description = "Home Assistant"; - wants = [ "network-online.target" ]; after = [ "network-online.target" diff --git a/nixos/modules/services/logging/journaldriver.nix b/nixos/modules/services/logging/journaldriver.nix index 4d21464018aac2e..59eedff90d60e1f 100644 --- a/nixos/modules/services/logging/journaldriver.nix +++ b/nixos/modules/services/logging/journaldriver.nix @@ -84,7 +84,6 @@ 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" ]; diff --git a/nixos/modules/services/mail/roundcube.nix b/nixos/modules/services/mail/roundcube.nix index 3f1a695ab91ae95..c883c143e5234c1 100644 --- a/nixos/modules/services/mail/roundcube.nix +++ b/nixos/modules/services/mail/roundcube.nix @@ -250,7 +250,6 @@ in path = [ config.services.postgresql.package ]; }) { - wants = [ "network-online.target" ]; after = [ "network-online.target" ]; wantedBy = [ "multi-user.target" ]; script = let diff --git a/nixos/modules/services/mail/sympa.nix b/nixos/modules/services/mail/sympa.nix index 13fc8656a2b5a17..04ae46f66eeaf3a 100644 --- a/nixos/modules/services/mail/sympa.nix +++ b/nixos/modules/services/mail/sympa.nix @@ -435,7 +435,7 @@ in wantedBy = [ "multi-user.target" ]; after = [ "network-online.target" ]; - wants = sympaSubServices ++ [ "network-online.target" ]; + wants = sympaSubServices; before = sympaSubServices; serviceConfig = sympaServiceConfig "sympa_msg"; diff --git a/nixos/modules/services/matrix/synapse.nix b/nixos/modules/services/matrix/synapse.nix index 4c1c396eac05649..50019d2a25cb520 100644 --- a/nixos/modules/services/matrix/synapse.nix +++ b/nixos/modules/services/matrix/synapse.nix @@ -1056,7 +1056,6 @@ 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" ]; }; @@ -1072,7 +1071,6 @@ 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" ]; diff --git a/nixos/modules/services/misc/amazon-ssm-agent.nix b/nixos/modules/services/misc/amazon-ssm-agent.nix index 89a1c07665106b6..20b836abe164fe1 100644 --- a/nixos/modules/services/misc/amazon-ssm-agent.nix +++ b/nixos/modules/services/misc/amazon-ssm-agent.nix @@ -41,7 +41,6 @@ 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" ]; diff --git a/nixos/modules/services/misc/bcg.nix b/nixos/modules/services/misc/bcg.nix index ad0b9c871342fb9..9da4a879cdd0090 100644 --- a/nixos/modules/services/misc/bcg.nix +++ b/nixos/modules/services/misc/bcg.nix @@ -154,7 +154,7 @@ in in { description = "BigClown Gateway"; wantedBy = [ "multi-user.target" ]; - wants = [ "network-online.target" ] ++ lib.optional config.services.mosquitto.enable "mosquitto.service"; + wants = mkIf config.services.mosquitto.enable [ "mosquitto.service" ]; after = [ "network-online.target" ]; preStart = '' umask 077 diff --git a/nixos/modules/services/misc/domoticz.nix b/nixos/modules/services/misc/domoticz.nix index 315092f9335149c..fd9fcf0b78eb57f 100644 --- a/nixos/modules/services/misc/domoticz.nix +++ b/nixos/modules/services/misc/domoticz.nix @@ -35,7 +35,6 @@ in { systemd.services."domoticz" = { description = pkgDesc; wantedBy = [ "multi-user.target" ]; - wants = [ "network-online.target" ]; after = [ "network-online.target" ]; serviceConfig = { DynamicUser = true; diff --git a/nixos/modules/services/misc/etesync-dav.nix b/nixos/modules/services/misc/etesync-dav.nix index ae2b5ad04343390..9d99d548d95b041 100644 --- a/nixos/modules/services/misc/etesync-dav.nix +++ b/nixos/modules/services/misc/etesync-dav.nix @@ -59,7 +59,6 @@ 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 ]; diff --git a/nixos/modules/services/misc/mediatomb.nix b/nixos/modules/services/misc/mediatomb.nix index 03235e9a12655c4..d421d74c53ad7ce 100644 --- a/nixos/modules/services/misc/mediatomb.nix +++ b/nixos/modules/services/misc/mediatomb.nix @@ -357,7 +357,6 @@ 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}"; diff --git a/nixos/modules/services/misc/metabase.nix b/nixos/modules/services/misc/metabase.nix index 5fc18e27eaae40b..883fa0b95911674 100644 --- a/nixos/modules/services/misc/metabase.nix +++ b/nixos/modules/services/misc/metabase.nix @@ -77,7 +77,6 @@ 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"; diff --git a/nixos/modules/services/misc/paperless.nix b/nixos/modules/services/misc/paperless.nix index ca34a327dbdfa04..3c6832958f59a43 100644 --- a/nixos/modules/services/misc/paperless.nix +++ b/nixos/modules/services/misc/paperless.nix @@ -297,7 +297,6 @@ in wantedBy = [ "paperless-scheduler.service" ]; before = [ "paperless-scheduler.service" ]; after = [ "network-online.target" ]; - wants = [ "network-online.target" ]; serviceConfig = defaultServiceConfig // { User = cfg.user; Type = "oneshot"; diff --git a/nixos/modules/services/monitoring/mackerel-agent.nix b/nixos/modules/services/monitoring/mackerel-agent.nix index 5915634ed26fe9f..62a7858500f244c 100644 --- a/nixos/modules/services/monitoring/mackerel-agent.nix +++ b/nixos/modules/services/monitoring/mackerel-agent.nix @@ -84,7 +84,6 @@ 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 = { diff --git a/nixos/modules/services/monitoring/prometheus/alertmanager.nix b/nixos/modules/services/monitoring/prometheus/alertmanager.nix index bb426d8b7beb03a..4fd630015f35ae6 100644 --- a/nixos/modules/services/monitoring/prometheus/alertmanager.nix +++ b/nixos/modules/services/monitoring/prometheus/alertmanager.nix @@ -174,7 +174,6 @@ 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" \ diff --git a/nixos/modules/services/monitoring/teamviewer.nix b/nixos/modules/services/monitoring/teamviewer.nix index 7c45247aa6d5a30..9b1278317943d80 100644 --- a/nixos/modules/services/monitoring/teamviewer.nix +++ b/nixos/modules/services/monitoring/teamviewer.nix @@ -30,7 +30,6 @@ 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"; diff --git a/nixos/modules/services/monitoring/telegraf.nix b/nixos/modules/services/monitoring/telegraf.nix index 3bab8aba7bd607d..ee28ee03adf33c8 100644 --- a/nixos/modules/services/monitoring/telegraf.nix +++ b/nixos/modules/services/monitoring/telegraf.nix @@ -59,7 +59,6 @@ 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 = { diff --git a/nixos/modules/services/network-filesystems/openafs/client.nix b/nixos/modules/services/network-filesystems/openafs/client.nix index 02c3482ec657b78..bb0fee087e62ea1 100644 --- a/nixos/modules/services/network-filesystems/openafs/client.nix +++ b/nixos/modules/services/network-filesystems/openafs/client.nix @@ -215,7 +215,6 @@ 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; diff --git a/nixos/modules/services/networking/bitcoind.nix b/nixos/modules/services/networking/bitcoind.nix index 59722e31c62ab2b..4512e666ba5badc 100644 --- a/nixos/modules/services/networking/bitcoind.nix +++ b/nixos/modules/services/networking/bitcoind.nix @@ -198,7 +198,6 @@ in ''; in { description = "Bitcoin daemon"; - wants = [ "network-online.target" ]; after = [ "network-online.target" ]; wantedBy = [ "multi-user.target" ]; serviceConfig = { diff --git a/nixos/modules/services/networking/dante.nix b/nixos/modules/services/networking/dante.nix index f0d1d6305c54d8f..605f2d74f827553 100644 --- a/nixos/modules/services/networking/dante.nix +++ b/nixos/modules/services/networking/dante.nix @@ -47,7 +47,6 @@ 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" ]; diff --git a/nixos/modules/services/networking/ergo.nix b/nixos/modules/services/networking/ergo.nix index 1bee0f43f988ac5..033d4d9caf8a85e 100644 --- a/nixos/modules/services/networking/ergo.nix +++ b/nixos/modules/services/networking/ergo.nix @@ -114,7 +114,6 @@ in { systemd.services.ergo = { description = "ergo server"; wantedBy = [ "multi-user.target" ]; - wants = [ "network-online.target" ]; after = [ "network-online.target" ]; serviceConfig = { User = cfg.user; diff --git a/nixos/modules/services/networking/expressvpn.nix b/nixos/modules/services/networking/expressvpn.nix index 05c24d8bccffcd9..30de6987d31fe52 100644 --- a/nixos/modules/services/networking/expressvpn.nix +++ b/nixos/modules/services/networking/expressvpn.nix @@ -21,7 +21,6 @@ with lib; RestartSec = 5; }; wantedBy = [ "multi-user.target" ]; - wants = [ "network-online.target" ]; after = [ "network.target" "network-online.target" ]; }; }; diff --git a/nixos/modules/services/networking/headscale.nix b/nixos/modules/services/networking/headscale.nix index 95b5fcf6ebde88b..4224a0578cc30c9 100644 --- a/nixos/modules/services/networking/headscale.nix +++ b/nixos/modules/services/networking/headscale.nix @@ -460,7 +460,6 @@ in { systemd.services.headscale = { description = "headscale coordination server for Tailscale"; - wants = [ "network-online.target" ]; after = ["network-online.target"]; wantedBy = ["multi-user.target"]; restartTriggers = [configFile]; diff --git a/nixos/modules/services/networking/ircd-hybrid/default.nix b/nixos/modules/services/networking/ircd-hybrid/default.nix index 64a34cc52d25a9e..554b0f7bb8b4417 100644 --- a/nixos/modules/services/networking/ircd-hybrid/default.nix +++ b/nixos/modules/services/networking/ircd-hybrid/default.nix @@ -125,8 +125,7 @@ in systemd.services.ircd-hybrid = { description = "IRCD Hybrid server"; - wants = [ "network-online.target" ]; - after = [ "network-online.target" ]; + after = [ "started networking" ]; wantedBy = [ "multi-user.target" ]; script = "${ircdService}/bin/control start"; }; diff --git a/nixos/modules/services/networking/ivpn.nix b/nixos/modules/services/networking/ivpn.nix index 6c9ae599e670f45..6df630c1f1947ea 100644 --- a/nixos/modules/services/networking/ivpn.nix +++ b/nixos/modules/services/networking/ivpn.nix @@ -27,7 +27,7 @@ with lib; systemd.services.ivpn-service = { description = "iVPN daemon"; wantedBy = [ "multi-user.target" ]; - wants = [ "network.target" "network-online.target" ]; + wants = [ "network.target" ]; after = [ "network-online.target" "NetworkManager.service" diff --git a/nixos/modules/services/networking/kea.nix b/nixos/modules/services/networking/kea.nix index 656ddd41fd12b1b..5ca705976c413c9 100644 --- a/nixos/modules/services/networking/kea.nix +++ b/nixos/modules/services/networking/kea.nix @@ -325,9 +325,6 @@ in "network-online.target" "time-sync.target" ]; - wants = [ - "network-online.target" - ]; wantedBy = [ "multi-user.target" ]; @@ -375,9 +372,6 @@ in "network-online.target" "time-sync.target" ]; - wants = [ - "network-online.target" - ]; wantedBy = [ "multi-user.target" ]; @@ -419,7 +413,6 @@ in "https://kea.readthedocs.io/en/kea-${package.version}/arm/ddns.html" ]; - wants = [ "network-online.target" ]; after = [ "network-online.target" "time-sync.target" diff --git a/nixos/modules/services/networking/mosquitto.nix b/nixos/modules/services/networking/mosquitto.nix index ad9eefb422525e9..f2b158b989427a6 100644 --- a/nixos/modules/services/networking/mosquitto.nix +++ b/nixos/modules/services/networking/mosquitto.nix @@ -596,7 +596,6 @@ in systemd.services.mosquitto = { description = "Mosquitto MQTT Broker Daemon"; wantedBy = [ "multi-user.target" ]; - wants = [ "network-online.target" ]; after = [ "network-online.target" ]; serviceConfig = { Type = "notify"; diff --git a/nixos/modules/services/networking/mullvad-vpn.nix b/nixos/modules/services/networking/mullvad-vpn.nix index 5da4ca1d1d8033b..446c71f40764d3a 100644 --- a/nixos/modules/services/networking/mullvad-vpn.nix +++ b/nixos/modules/services/networking/mullvad-vpn.nix @@ -53,7 +53,7 @@ with lib; systemd.services.mullvad-daemon = { description = "Mullvad VPN daemon"; wantedBy = [ "multi-user.target" ]; - wants = [ "network.target" "network-online.target" ]; + wants = [ "network.target" ]; after = [ "network-online.target" "NetworkManager.service" diff --git a/nixos/modules/services/networking/nbd.nix b/nixos/modules/services/networking/nbd.nix index b4bf7ede846329a..454380aa3154cee 100644 --- a/nixos/modules/services/networking/nbd.nix +++ b/nixos/modules/services/networking/nbd.nix @@ -117,7 +117,6 @@ in boot.kernelModules = [ "nbd" ]; systemd.services.nbd-server = { - wants = [ "network-online.target" ]; after = [ "network-online.target" ]; before = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ]; diff --git a/nixos/modules/services/networking/ocserv.nix b/nixos/modules/services/networking/ocserv.nix index 3c61d56b893e991..9548fd92dbda343 100644 --- a/nixos/modules/services/networking/ocserv.nix +++ b/nixos/modules/services/networking/ocserv.nix @@ -85,7 +85,6 @@ 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" ]; diff --git a/nixos/modules/services/networking/pleroma.nix b/nixos/modules/services/networking/pleroma.nix index 8470f5e9cbc0c4a..db0a61b8346993a 100644 --- a/nixos/modules/services/networking/pleroma.nix +++ b/nixos/modules/services/networking/pleroma.nix @@ -92,7 +92,6 @@ 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 ]; diff --git a/nixos/modules/services/networking/rosenpass.nix b/nixos/modules/services/networking/rosenpass.nix index 487cb6f6014292e..d2a264b83d677ef 100644 --- a/nixos/modules/services/networking/rosenpass.nix +++ b/nixos/modules/services/networking/rosenpass.nix @@ -208,7 +208,6 @@ in in rec { wantedBy = [ "multi-user.target" ]; - wants = [ "network-online.target" ]; after = [ "network-online.target" ]; path = [ cfg.package pkgs.wireguard-tools ]; diff --git a/nixos/modules/services/networking/rxe.nix b/nixos/modules/services/networking/rxe.nix index 07437ed71195bdb..7dbb4823b4bcdd6 100644 --- a/nixos/modules/services/networking/rxe.nix +++ b/nixos/modules/services/networking/rxe.nix @@ -33,7 +33,7 @@ in { wantedBy = [ "multi-user.target" ]; after = [ "systemd-modules-load.service" "network-online.target" ]; - wants = [ "network-pre.target" "network-online.target" ]; + wants = [ "network-pre.target" ]; serviceConfig = { Type = "oneshot"; diff --git a/nixos/modules/services/networking/soju.nix b/nixos/modules/services/networking/soju.nix index d69ec08ca13a0c0..7f0ac3e3b8e69b7 100644 --- a/nixos/modules/services/networking/soju.nix +++ b/nixos/modules/services/networking/soju.nix @@ -110,7 +110,6 @@ in systemd.services.soju = { description = "soju IRC bouncer"; wantedBy = [ "multi-user.target" ]; - wants = [ "network-online.target" ]; after = [ "network-online.target" ]; serviceConfig = { DynamicUser = true; diff --git a/nixos/modules/services/networking/strongswan-swanctl/module.nix b/nixos/modules/services/networking/strongswan-swanctl/module.nix index a98850923955831..c8832ed4defb664 100644 --- a/nixos/modules/services/networking/strongswan-swanctl/module.nix +++ b/nixos/modules/services/networking/strongswan-swanctl/module.nix @@ -55,7 +55,6 @@ 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 = { diff --git a/nixos/modules/services/networking/strongswan.nix b/nixos/modules/services/networking/strongswan.nix index dcf04d2a1917ce3..e58526814d1ad05 100644 --- a/nixos/modules/services/networking/strongswan.nix +++ b/nixos/modules/services/networking/strongswan.nix @@ -153,7 +153,6 @@ 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; }; diff --git a/nixos/modules/services/networking/syncplay.nix b/nixos/modules/services/networking/syncplay.nix index 151259b6d4ad23f..0a66d93bf153a73 100644 --- a/nixos/modules/services/networking/syncplay.nix +++ b/nixos/modules/services/networking/syncplay.nix @@ -107,7 +107,6 @@ in systemd.services.syncplay = { description = "Syncplay Service"; wantedBy = [ "multi-user.target" ]; - wants = [ "network-online.target" ]; after = [ "network-online.target" ]; serviceConfig = { diff --git a/nixos/modules/services/networking/wasabibackend.nix b/nixos/modules/services/networking/wasabibackend.nix index e3a48afd2a2c58e..938145b35ee8844 100644 --- a/nixos/modules/services/networking/wasabibackend.nix +++ b/nixos/modules/services/networking/wasabibackend.nix @@ -119,7 +119,6 @@ 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"; diff --git a/nixos/modules/services/networking/znc/default.nix b/nixos/modules/services/networking/znc/default.nix index e15233293cf2560..d3ba4a524197dfb 100644 --- a/nixos/modules/services/networking/znc/default.nix +++ b/nixos/modules/services/networking/znc/default.nix @@ -243,7 +243,6 @@ in systemd.services.znc = { description = "ZNC Server"; wantedBy = [ "multi-user.target" ]; - wants = [ "network-online.target" ]; after = [ "network-online.target" ]; serviceConfig = { User = cfg.user; diff --git a/nixos/modules/services/security/certmgr.nix b/nixos/modules/services/security/certmgr.nix index 02cb7afe87badcc..db80e943973dc8e 100644 --- a/nixos/modules/services/security/certmgr.nix +++ b/nixos/modules/services/security/certmgr.nix @@ -182,7 +182,6 @@ 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; diff --git a/nixos/modules/services/security/oauth2_proxy.nix b/nixos/modules/services/security/oauth2_proxy.nix index d1dc37d549d2d4c..78916c907279a78 100644 --- a/nixos/modules/services/security/oauth2_proxy.nix +++ b/nixos/modules/services/security/oauth2_proxy.nix @@ -572,7 +572,6 @@ in description = "OAuth2 Proxy"; path = [ cfg.package ]; wantedBy = [ "multi-user.target" ]; - wants = [ "network-online.target" ]; after = [ "network-online.target" ]; serviceConfig = { diff --git a/nixos/modules/services/system/cachix-agent/default.nix b/nixos/modules/services/system/cachix-agent/default.nix index f8020fe970f1be6..196d3291d5555be 100644 --- a/nixos/modules/services/system/cachix-agent/default.nix +++ b/nixos/modules/services/system/cachix-agent/default.nix @@ -49,7 +49,6 @@ 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" ]; diff --git a/nixos/modules/services/system/cachix-watch-store.nix b/nixos/modules/services/system/cachix-watch-store.nix index d48af29465aa56d..8aa5f0358fa97d8 100644 --- a/nixos/modules/services/system/cachix-watch-store.nix +++ b/nixos/modules/services/system/cachix-watch-store.nix @@ -61,7 +61,6 @@ 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" ]; diff --git a/nixos/modules/services/video/go2rtc/default.nix b/nixos/modules/services/video/go2rtc/default.nix index 9dddbb60baa80fa..13851fa0306f633 100644 --- a/nixos/modules/services/video/go2rtc/default.nix +++ b/nixos/modules/services/video/go2rtc/default.nix @@ -94,7 +94,6 @@ in config = lib.mkIf cfg.enable { systemd.services.go2rtc = { - wants = [ "network-online.target" ]; after = [ "network-online.target" ]; diff --git a/nixos/modules/services/web-apps/akkoma.nix b/nixos/modules/services/web-apps/akkoma.nix index 4cd9e2664378727..8980556ab014228 100644 --- a/nixos/modules/services/web-apps/akkoma.nix +++ b/nixos/modules/services/web-apps/akkoma.nix @@ -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.target" ]; + wants = [ "network-online.service" ]; wantedBy = [ "multi-user.target" ]; after = [ "akkoma-config.target" diff --git a/nixos/modules/services/web-apps/alps.nix b/nixos/modules/services/web-apps/alps.nix index 81c6b8ad30b5f5d..05fb676102df462 100644 --- a/nixos/modules/services/web-apps/alps.nix +++ b/nixos/modules/services/web-apps/alps.nix @@ -94,7 +94,6 @@ 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 = { diff --git a/nixos/modules/services/web-apps/c2fmzq-server.nix b/nixos/modules/services/web-apps/c2fmzq-server.nix index dee131182de162a..87938fe160e1410 100644 --- a/nixos/modules/services/web-apps/c2fmzq-server.nix +++ b/nixos/modules/services/web-apps/c2fmzq-server.nix @@ -80,7 +80,6 @@ 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 = { diff --git a/nixos/modules/services/web-apps/code-server.nix b/nixos/modules/services/web-apps/code-server.nix index d087deb7848d07a..11601f6c3044994 100644 --- a/nixos/modules/services/web-apps/code-server.nix +++ b/nixos/modules/services/web-apps/code-server.nix @@ -205,7 +205,6 @@ in { systemd.services.code-server = { description = "Code server"; wantedBy = [ "multi-user.target" ]; - wants = [ "network-online.target" ]; after = [ "network-online.target" ]; path = cfg.extraPackages; environment = { diff --git a/nixos/modules/services/web-apps/healthchecks.nix b/nixos/modules/services/web-apps/healthchecks.nix index 1d439f162313be9..e5e425a29d54cfc 100644 --- a/nixos/modules/services/web-apps/healthchecks.nix +++ b/nixos/modules/services/web-apps/healthchecks.nix @@ -176,7 +176,6 @@ in systemd.targets.healthchecks = { description = "Target for all Healthchecks services"; wantedBy = [ "multi-user.target" ]; - wants = [ "network-online.target" ]; after = [ "network.target" "network-online.target" ]; }; diff --git a/nixos/modules/services/web-apps/netbox.nix b/nixos/modules/services/web-apps/netbox.nix index d034f3234a2bd79..23f76a2832aa732 100644 --- a/nixos/modules/services/web-apps/netbox.nix +++ b/nixos/modules/services/web-apps/netbox.nix @@ -271,7 +271,6 @@ 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" ]; }; diff --git a/nixos/modules/services/web-apps/openvscode-server.nix b/nixos/modules/services/web-apps/openvscode-server.nix index 81b9d1f3b4c8c52..76a19dccae1650f 100644 --- a/nixos/modules/services/web-apps/openvscode-server.nix +++ b/nixos/modules/services/web-apps/openvscode-server.nix @@ -159,7 +159,6 @@ 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; diff --git a/nixos/modules/services/web-apps/peering-manager.nix b/nixos/modules/services/web-apps/peering-manager.nix index 0382ce717473855..d6f6077268d46ec 100644 --- a/nixos/modules/services/web-apps/peering-manager.nix +++ b/nixos/modules/services/web-apps/peering-manager.nix @@ -196,7 +196,6 @@ 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" ]; }; diff --git a/nixos/modules/services/web-servers/agate.nix b/nixos/modules/services/web-servers/agate.nix index e03174c87945bd6..dce425035ff722f 100644 --- a/nixos/modules/services/web-servers/agate.nix +++ b/nixos/modules/services/web-servers/agate.nix @@ -71,7 +71,6 @@ in systemd.services.agate = { description = "Agate"; wantedBy = [ "multi-user.target" ]; - wants = [ "network-online.target" ]; after = [ "network.target" "network-online.target" ]; script = diff --git a/nixos/modules/services/web-servers/mighttpd2.nix b/nixos/modules/services/web-servers/mighttpd2.nix index bb75dc4f2ff47b8..bdd6d8b62aa36f7 100644 --- a/nixos/modules/services/web-servers/mighttpd2.nix +++ b/nixos/modules/services/web-servers/mighttpd2.nix @@ -101,7 +101,6 @@ in { ]; systemd.services.mighttpd2 = { description = "Mighttpd2 web server"; - wants = [ "network-online.target" ]; after = [ "network-online.target" ]; wantedBy = [ "multi-user.target" ]; serviceConfig = { diff --git a/nixos/modules/services/web-servers/minio.nix b/nixos/modules/services/web-servers/minio.nix index be6946657e23d35..6431db250476bfe 100644 --- a/nixos/modules/services/web-servers/minio.nix +++ b/nixos/modules/services/web-servers/minio.nix @@ -98,7 +98,6 @@ in services.minio = { description = "Minio Object Storage"; - wants = [ "network-online.target" ]; after = [ "network-online.target" ]; wantedBy = [ "multi-user.target" ]; serviceConfig = { diff --git a/nixos/modules/services/web-servers/traefik.nix b/nixos/modules/services/web-servers/traefik.nix index fc9eb504ebf81f8..cc2c680b3342439 100644 --- a/nixos/modules/services/web-servers/traefik.nix +++ b/nixos/modules/services/web-servers/traefik.nix @@ -144,7 +144,6 @@ in { systemd.services.traefik = { description = "Traefik web server"; - wants = [ "network-online.target" ]; after = [ "network-online.target" ]; wantedBy = [ "multi-user.target" ]; startLimitIntervalSec = 86400; diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index 331ca5103ba618f..46c3f66f02dcf04 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -451,37 +451,20 @@ in 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) - ]; + 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 + ); system.build.units = cfg.units; @@ -658,6 +641,7 @@ 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 diff --git a/nixos/modules/virtualisation/amazon-image.nix b/nixos/modules/virtualisation/amazon-image.nix index f0d9b95f81f6b4a..aa44f26426970dc 100644 --- a/nixos/modules/virtualisation/amazon-image.nix +++ b/nixos/modules/virtualisation/amazon-image.nix @@ -71,7 +71,6 @@ 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; diff --git a/nixos/modules/virtualisation/oci-containers.nix b/nixos/modules/virtualisation/oci-containers.nix index 07ed08ab2f84d84..a4a40346f093b25 100644 --- a/nixos/modules/virtualisation/oci-containers.nix +++ b/nixos/modules/virtualisation/oci-containers.nix @@ -267,7 +267,6 @@ 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" ] diff --git a/nixos/tests/3proxy.nix b/nixos/tests/3proxy.nix index b80b4e166d48100..83d39de018a398d 100644 --- a/nixos/tests/3proxy.nix +++ b/nixos/tests/3proxy.nix @@ -134,7 +134,6 @@ testScript = '' start_all() - peer0.systemctl("start network-online.target") peer0.wait_for_unit("network-online.target") peer1.wait_for_unit("3proxy.service") diff --git a/nixos/tests/acme.nix b/nixos/tests/acme.nix index 272782dc2f621da..e5f2d4c7934a1b8 100644 --- a/nixos/tests/acme.nix +++ b/nixos/tests/acme.nix @@ -522,7 +522,6 @@ 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") diff --git a/nixos/tests/adguardhome.nix b/nixos/tests/adguardhome.nix index 80613ce82534029..a6f790b83f5fcab 100644 --- a/nixos/tests/adguardhome.nix +++ b/nixos/tests/adguardhome.nix @@ -126,7 +126,6 @@ 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") diff --git a/nixos/tests/babeld.nix b/nixos/tests/babeld.nix index e497aa5b64e1519..d4df6f86d089d82 100644 --- a/nixos/tests/babeld.nix +++ b/nixos/tests/babeld.nix @@ -120,6 +120,10 @@ 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") diff --git a/nixos/tests/bittorrent.nix b/nixos/tests/bittorrent.nix index 473b05d4c98e893..4a73fea6a09d0bb 100644 --- a/nixos/tests/bittorrent.nix +++ b/nixos/tests/bittorrent.nix @@ -115,7 +115,6 @@ 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") @@ -130,7 +129,6 @@ 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) @@ -142,7 +140,6 @@ 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") @@ -155,7 +152,6 @@ 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 &" diff --git a/nixos/tests/buildbot.nix b/nixos/tests/buildbot.nix index 149d73bba09c5ec..2f6926313b7cdaa 100644 --- a/nixos/tests/buildbot.nix +++ b/nixos/tests/buildbot.nix @@ -71,7 +71,6 @@ 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") @@ -79,7 +78,6 @@ 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") diff --git a/nixos/tests/corerad.nix b/nixos/tests/corerad.nix index dd2bec794a1a0a9..b6f5d7fc6f75b58 100644 --- a/nixos/tests/corerad.nix +++ b/nixos/tests/corerad.nix @@ -56,8 +56,6 @@ 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") diff --git a/nixos/tests/curl-impersonate.nix b/nixos/tests/curl-impersonate.nix index 33b10da1dfd0ff2..7954e9e5584c41f 100644 --- a/nixos/tests/curl-impersonate.nix +++ b/nixos/tests/curl-impersonate.nix @@ -144,8 +144,6 @@ 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") diff --git a/nixos/tests/ferm.nix b/nixos/tests/ferm.nix index 87c67ac623479ee..be43877445ebf1a 100644 --- a/nixos/tests/ferm.nix +++ b/nixos/tests/ferm.nix @@ -55,8 +55,6 @@ 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") diff --git a/nixos/tests/gitdaemon.nix b/nixos/tests/gitdaemon.nix index 052fa902b45049b..bb07b6e97b7fb43 100644 --- a/nixos/tests/gitdaemon.nix +++ b/nixos/tests/gitdaemon.nix @@ -59,9 +59,6 @@ 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") diff --git a/nixos/tests/guix/publish.nix b/nixos/tests/guix/publish.nix index eb56fc97478cc54..a15e00b0fa981cd 100644 --- a/nixos/tests/guix/publish.nix +++ b/nixos/tests/guix/publish.nix @@ -80,7 +80,6 @@ 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 diff --git a/nixos/tests/hostname.nix b/nixos/tests/hostname.nix index dffec956bc0b684..6122e2ffeb83a65 100644 --- a/nixos/tests/hostname.nix +++ b/nixos/tests/hostname.nix @@ -34,7 +34,6 @@ 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): diff --git a/nixos/tests/installer.nix b/nixos/tests/installer.nix index 7576fae41f83b97..21d5e1470d8e00e 100644 --- a/nixos/tests/installer.nix +++ b/nixos/tests/installer.nix @@ -158,9 +158,7 @@ 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") @@ -189,7 +187,6 @@ 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')''} diff --git a/nixos/tests/kanidm.nix b/nixos/tests/kanidm.nix index fa24d4a8a5e130b..3f5bca397740eff 100644 --- a/nixos/tests/kanidm.nix +++ b/nixos/tests/kanidm.nix @@ -67,7 +67,6 @@ 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"): diff --git a/nixos/tests/lemmy.nix b/nixos/tests/lemmy.nix index e8d747f89a9e774..de2c4938fe23195 100644 --- a/nixos/tests/lemmy.nix +++ b/nixos/tests/lemmy.nix @@ -59,7 +59,6 @@ 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) @@ -67,7 +66,6 @@ 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}") diff --git a/nixos/tests/networking.nix b/nixos/tests/networking.nix index 6bd89902eedb337..768d0cfa2238c0e 100644 --- a/nixos/tests/networking.nix +++ b/nixos/tests/networking.nix @@ -130,7 +130,6 @@ 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"): @@ -223,7 +222,6 @@ 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"): @@ -851,7 +849,6 @@ 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"): diff --git a/nixos/tests/nfs/kerberos.nix b/nixos/tests/nfs/kerberos.nix index 5944b53319a0b65..1bace4058be59bc 100644 --- a/nixos/tests/nfs/kerberos.nix +++ b/nixos/tests/nfs/kerberos.nix @@ -105,7 +105,6 @@ 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 diff --git a/nixos/tests/opensmtpd-rspamd.nix b/nixos/tests/opensmtpd-rspamd.nix index e413a2050bd61d3..19969a7b47dddf0 100644 --- a/nixos/tests/opensmtpd-rspamd.nix +++ b/nixos/tests/opensmtpd-rspamd.nix @@ -119,7 +119,6 @@ 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") diff --git a/nixos/tests/opensmtpd.nix b/nixos/tests/opensmtpd.nix index d32f82ed33b8c19..17c1a569ba0d942 100644 --- a/nixos/tests/opensmtpd.nix +++ b/nixos/tests/opensmtpd.nix @@ -104,7 +104,6 @@ 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") diff --git a/nixos/tests/owncast.nix b/nixos/tests/owncast.nix index 73aac4e704751c2..debb34f5009dcd4 100644 --- a/nixos/tests/owncast.nix +++ b/nixos/tests/owncast.nix @@ -31,8 +31,6 @@ 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") diff --git a/nixos/tests/qemu-vm-restrictnetwork.nix b/nixos/tests/qemu-vm-restrictnetwork.nix index 49aefcc099bda8b..49a105ef10767fd 100644 --- a/nixos/tests/qemu-vm-restrictnetwork.nix +++ b/nixos/tests/qemu-vm-restrictnetwork.nix @@ -21,8 +21,6 @@ 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") diff --git a/nixos/tests/rss2email.nix b/nixos/tests/rss2email.nix index 60b27b95fabe4a3..f32326feb50fb91 100644 --- a/nixos/tests/rss2email.nix +++ b/nixos/tests/rss2email.nix @@ -55,7 +55,6 @@ 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") diff --git a/nixos/tests/ssh-audit.nix b/nixos/tests/ssh-audit.nix index 25772aba3ea08dd..bd6255b8044d98d 100644 --- a/nixos/tests/ssh-audit.nix +++ b/nixos/tests/ssh-audit.nix @@ -70,7 +70,6 @@ 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 diff --git a/nixos/tests/systemd-networkd-dhcpserver.nix b/nixos/tests/systemd-networkd-dhcpserver.nix index 665d8b5a0529199..cf0ccb74421181f 100644 --- a/nixos/tests/systemd-networkd-dhcpserver.nix +++ b/nixos/tests/systemd-networkd-dhcpserver.nix @@ -101,9 +101,6 @@ 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") diff --git a/nixos/tests/systemd-networkd-ipv6-prefix-delegation.nix b/nixos/tests/systemd-networkd-ipv6-prefix-delegation.nix index 1e55341657bdb4a..54f371e6c070f07 100644 --- a/nixos/tests/systemd-networkd-ipv6-prefix-delegation.nix +++ b/nixos/tests/systemd-networkd-ipv6-prefix-delegation.nix @@ -263,6 +263,9 @@ 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 @@ -275,6 +278,9 @@ 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" ]; }; }; @@ -288,7 +294,6 @@ 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 @@ -307,7 +312,6 @@ 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") diff --git a/nixos/tests/systemd-nspawn.nix b/nixos/tests/systemd-nspawn.nix index b86762233d183ea..1a4251ef069e8e3 100644 --- a/nixos/tests/systemd-nspawn.nix +++ b/nixos/tests/systemd-nspawn.nix @@ -38,7 +38,6 @@ 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( diff --git a/nixos/tests/tayga.nix b/nixos/tests/tayga.nix index 4aade67d74d0d4a..44974f6efea8349 100644 --- a/nixos/tests/tayga.nix +++ b/nixos/tests/tayga.nix @@ -206,7 +206,6 @@ 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]) @@ -215,7 +214,6 @@ 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]) diff --git a/nixos/tests/trafficserver.nix b/nixos/tests/trafficserver.nix index 94d0e4dd926e965..e4557c6c50e5420 100644 --- a/nixos/tests/trafficserver.nix +++ b/nixos/tests/trafficserver.nix @@ -104,7 +104,6 @@ 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"): diff --git a/nixos/tests/ulogd/ulogd.py b/nixos/tests/ulogd/ulogd.py index 76a8d0c6e24a36a..d20daa4d733a2f0 100644 --- a/nixos/tests/ulogd/ulogd.py +++ b/nixos/tests/ulogd/ulogd.py @@ -1,6 +1,5 @@ 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"): diff --git a/nixos/tests/upnp.nix b/nixos/tests/upnp.nix index 93bc08f752ce334..5e135267403bd13 100644 --- a/nixos/tests/upnp.nix +++ b/nixos/tests/upnp.nix @@ -81,13 +81,11 @@ 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") diff --git a/nixos/tests/uptermd.nix b/nixos/tests/uptermd.nix index 469aa5047c27c8b..429e3c9dd5ff34f 100644 --- a/nixos/tests/uptermd.nix +++ b/nixos/tests/uptermd.nix @@ -28,7 +28,6 @@ in start_all() server.wait_for_unit("uptermd.service") - server.systemctl("start network-online.target") server.wait_for_unit("network-online.target") # wait for upterm port to be reachable diff --git a/nixos/tests/zrepl.nix b/nixos/tests/zrepl.nix index bdf11122c73f6cc..b16c7eddc7aeccd 100644 --- a/nixos/tests/zrepl.nix +++ b/nixos/tests/zrepl.nix @@ -42,7 +42,6 @@ import ./make-test-python.nix ( start_all() with subtest("Wait for zrepl and network ready"): - host.systemctl("start network-online.target") host.wait_for_unit("network-online.target") host.wait_for_unit("zrepl.service")