about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorMaciej Krüger <mkg20001@gmail.com>2023-12-24 13:54:48 +0100
committerMaciej Krüger <mkg20001@gmail.com>2024-01-12 17:29:05 +0100
commitc0ef1f947903325d9cdc84edf011041b52d59fa3 (patch)
tree94d04ab531aae55e1be4b150596cd2792817c81c /nixos
parent9e2cd6f8728c79b6298f8005292fae9bec0bcf97 (diff)
nixos/network-interfaces: add assertion if used in after or wants
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/system/boot/systemd.nix15
1 files changed, 15 insertions, 0 deletions
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 ];