diff options
author | Robert Hensing <robert@roberthensing.nl> | 2023-04-17 20:14:07 +0200 |
---|---|---|
committer | Robert Hensing <robert@roberthensing.nl> | 2023-05-06 18:32:59 +0200 |
commit | fd88c79418bbb26758a89d111f136abdc8825acd (patch) | |
tree | 1ea0c2194cf8d2f1ebb593372d8332f34ebd443e /lib/modules.nix | |
parent | 7459c024950282da952d43762ad93ff30995cc6a (diff) | |
download | nixlib-fd88c79418bbb26758a89d111f136abdc8825acd.tar nixlib-fd88c79418bbb26758a89d111f136abdc8825acd.tar.gz nixlib-fd88c79418bbb26758a89d111f136abdc8825acd.tar.bz2 nixlib-fd88c79418bbb26758a89d111f136abdc8825acd.tar.lz nixlib-fd88c79418bbb26758a89d111f136abdc8825acd.tar.xz nixlib-fd88c79418bbb26758a89d111f136abdc8825acd.tar.zst nixlib-fd88c79418bbb26758a89d111f136abdc8825acd.zip |
lib.modules: Change class declaration in module to _class
Diffstat (limited to 'lib/modules.nix')
-rw-r--r-- | lib/modules.nix | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/modules.nix b/lib/modules.nix index 3550ebddaeac..c6d178e7ff9a 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -371,10 +371,10 @@ 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}." + throw "The module ${m._file or m.key} was imported into ${class} instead of ${m._class}." else m: m; @@ -475,28 +475,28 @@ let else config; in if m ? config || m ? options then - let badAttrs = removeAttrs m ["_file" "key" "disabledModules" "imports" "options" "config" "meta" "freeformType" "class"]; in + let badAttrs = removeAttrs m ["_class" "_file" "key" "disabledModules" "imports" "options" "config" "meta" "freeformType"]; in if badAttrs != {} then throw "Module `${key}' has an unsupported attribute `${head (attrNames badAttrs)}'. This is caused by introducing a top-level `config' or `options' attribute. Add configuration attributes immediately on the top level instead, or move all of them (namely: ${toString (attrNames badAttrs)}) into the explicit `config' attribute." else { _file = toString m._file or file; + _class = m._class or null; key = toString m.key or key; disabledModules = m.disabledModules or []; imports = m.imports or []; options = m.options or {}; config = addFreeformType (addMeta (m.config or {})); - class = m.class or null; } else # shorthand syntax lib.throwIfNot (isAttrs m) "module ${file} (${key}) does not look like a module." { _file = toString m._file or file; + _class = m._class or null; key = toString m.key or key; disabledModules = m.disabledModules or []; imports = m.require or [] ++ m.imports or []; options = {}; - config = addFreeformType (removeAttrs m ["_file" "key" "disabledModules" "require" "imports" "freeformType"]); - class = null; + config = addFreeformType (removeAttrs m ["_class" "_file" "key" "disabledModules" "require" "imports" "freeformType"]); }; applyModuleArgsIfFunction = key: f: args@{ config, options, lib, ... }: |