From 9e2cd6f8728c79b6298f8005292fae9bec0bcf97 Mon Sep 17 00:00:00 2001 From: Niko <97130632+Nyabinary@users.noreply.github.com> Date: Wed, 20 Dec 2023 11:53:35 -0500 Subject: nixos/network-interfaces: remove network-interfaces.target Co-authored-by: Martin Weinelt --- nixos/doc/manual/release-notes/rl-2405.section.md | 2 ++ nixos/modules/tasks/network-interfaces.nix | 10 ---------- 2 files changed, 2 insertions(+), 10 deletions(-) (limited to 'nixos') diff --git a/nixos/doc/manual/release-notes/rl-2405.section.md b/nixos/doc/manual/release-notes/rl-2405.section.md index 5c05ad780d90d..4f01e74d849c9 100644 --- a/nixos/doc/manual/release-notes/rl-2405.section.md +++ b/nixos/doc/manual/release-notes/rl-2405.section.md @@ -65,6 +65,8 @@ The pre-existing [services.ankisyncd](#opt-services.ankisyncd.enable) has been m - `paperless`' `services.paperless.extraConfig` setting has been removed and converted to the freeform type and option named `services.paperless.settings`. +- The legacy and long deprecated systemd target `network-interfaces.target` has been removed. Use `network.target` instead. + - `mkosi` was updated to v19. Parts of the user interface have changed. Consult the [release notes](https://github.com/systemd/mkosi/releases/tag/v19) for a list of changes. diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix index 2b2d24a64cb20..ca0b219b3c93d 100644 --- a/nixos/modules/tasks/network-interfaces.nix +++ b/nixos/modules/tasks/network-interfaces.nix @@ -1449,16 +1449,6 @@ in listToAttrs ]; - # The network-interfaces target is kept for backwards compatibility. - # New modules must NOT use it. - systemd.targets.network-interfaces = - { description = "All Network Interfaces (deprecated)"; - wantedBy = [ "network.target" ]; - before = [ "network.target" ]; - after = [ "network-pre.target" ]; - unitConfig.X-StopOnReconfiguration = true; - }; - systemd.services = { network-local-commands = { description = "Extra networking commands."; -- cgit 1.4.1 From c0ef1f947903325d9cdc84edf011041b52d59fa3 Mon Sep 17 00:00:00 2001 From: Maciej Krüger Date: Sun, 24 Dec 2023 13:54:48 +0100 Subject: nixos/network-interfaces: add assertion if used in after or wants --- nixos/modules/system/boot/systemd.nix | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'nixos') diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index 87333999313e4..c3902007906ad 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -451,6 +451,21 @@ 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 + ); + system.build.units = cfg.units; system.nssModules = [ cfg.package.out ]; -- cgit 1.4.1