From 62f30634db2146c23f9aff1c9b598524652bbeb7 Mon Sep 17 00:00:00 2001 From: Jade Lovelace Date: Sun, 1 Oct 2023 15:24:11 -0700 Subject: [PATCH] nixos/systemd: don't require network-online.target for multi-user.target Previously we required network-online.target for multi-user.target. This has made a lot of people very angry and has been widely regarded as a bad move (or at least, very nonstandard): https://github.com/NixOS/nixpkgs/commit/15d761a525a025de0680b62e8ab79a9d183f313d#commitcomment-128564097 This was done because of fragile tests and services declaring dependencies on multi-user.target when they meant network-online.target. Let's rip off the bandaid and fix our tests. --- nixos/doc/manual/release-notes/rl-2405.section.md | 7 +++++++ nixos/modules/system/boot/systemd.nix | 1 - 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/nixos/doc/manual/release-notes/rl-2405.section.md b/nixos/doc/manual/release-notes/rl-2405.section.md index 9e8ef49783ca..c53a1dcce320 100644 --- a/nixos/doc/manual/release-notes/rl-2405.section.md +++ b/nixos/doc/manual/release-notes/rl-2405.section.md @@ -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. diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index 46c3f66f02dc..b02f615245d4 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -641,7 +641,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