diff --git a/lib/modules.nix b/lib/modules.nix index f5b8af0e9858b..79b8f25c2f434 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -364,7 +364,7 @@ let if class != null then m: - if m._class != null -> m._class == class + if m._class == null || m._class == class then m else throw "The module ${m._file or m.key} was imported into ${class} instead of ${m._class}."