lol

lib.modules: in evalModules return move _module.class -> configurationClass

+10 -11
+8
doc/module-system/module-system.chapter.md
··· 95 95 A portion of the configuration tree which is elided from `config`. 96 96 97 97 <!-- TODO: when markdown migration is complete, make _module docs visible again and reference _module docs. Maybe move those docs into this chapter? --> 98 + 99 + #### `_type` {#module-system-lib-evalModules-return-value-_type} 100 + 101 + A nominal type marker, always `"configuration"`. 102 + 103 + #### `configurationClass` {#module-system-lib-evalModules-return-value-_configurationClass} 104 + 105 + Equal to the [`class` parameter](#module-system-lib-evalModules-param-class).
+1 -11
lib/modules.nix
··· 220 220 within a configuration, but can be used in module imports. 221 221 ''; 222 222 }; 223 - 224 - _module.class = mkOption { 225 - readOnly = true; 226 - internal = true; 227 - description = lib.mdDoc '' 228 - If the `class` attribute is set and non-`null`, the module system will reject `imports` with a different `class`. 229 - 230 - This option contains the expected `class` attribute of the current module evaluation. 231 - ''; 232 - }; 233 223 }; 234 224 235 225 config = { ··· 237 227 inherit extendModules; 238 228 moduleType = type; 239 229 }; 240 - _module.class = class; 241 230 _module.specialArgs = specialArgs; 242 231 }; 243 232 }; ··· 337 326 config = checked (removeAttrs config [ "_module" ]); 338 327 _module = checked (config._module); 339 328 inherit extendModules type; 329 + configurationClass = class; 340 330 }; 341 331 in result; 342 332
+1
lib/tests/modules.sh
··· 364 364 365 365 # Class checks, evalModules 366 366 checkConfigOutput '^{ }$' config.ok.config ./class-check.nix 367 + checkConfigOutput '"nixos"' config.ok.configurationClass ./class-check.nix 367 368 checkConfigError 'The module .*/module-class-is-darwin.nix was imported into nixos instead of darwin.' config.fail.config ./class-check.nix 368 369 checkConfigError 'The module foo.nix#darwinModules.default was imported into nixos instead of darwin.' config.fail-anon.config ./class-check.nix 369 370