mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 16:33:15 +00:00
lib.modules: in evalModules return move _module.class -> configurationClass
This commit is contained in:
parent
4c7aa7d831
commit
89491bef8d
@ -95,3 +95,11 @@ If you do reference multiple `config` (or `options`) from before and after `exte
|
||||
A portion of the configuration tree which is elided from `config`.
|
||||
|
||||
<!-- TODO: when markdown migration is complete, make _module docs visible again and reference _module docs. Maybe move those docs into this chapter? -->
|
||||
|
||||
#### `_type` {#module-system-lib-evalModules-return-value-_type}
|
||||
|
||||
A nominal type marker, always `"configuration"`.
|
||||
|
||||
#### `configurationClass` {#module-system-lib-evalModules-return-value-_configurationClass}
|
||||
|
||||
Equal to the [`class` parameter](#module-system-lib-evalModules-param-class).
|
||||
|
@ -220,16 +220,6 @@ let
|
||||
within a configuration, but can be used in module imports.
|
||||
'';
|
||||
};
|
||||
|
||||
_module.class = mkOption {
|
||||
readOnly = true;
|
||||
internal = true;
|
||||
description = lib.mdDoc ''
|
||||
If the `class` attribute is set and non-`null`, the module system will reject `imports` with a different `class`.
|
||||
|
||||
This option contains the expected `class` attribute of the current module evaluation.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
@ -237,7 +227,6 @@ let
|
||||
inherit extendModules;
|
||||
moduleType = type;
|
||||
};
|
||||
_module.class = class;
|
||||
_module.specialArgs = specialArgs;
|
||||
};
|
||||
};
|
||||
@ -337,6 +326,7 @@ let
|
||||
config = checked (removeAttrs config [ "_module" ]);
|
||||
_module = checked (config._module);
|
||||
inherit extendModules type;
|
||||
configurationClass = class;
|
||||
};
|
||||
in result;
|
||||
|
||||
|
@ -364,6 +364,7 @@ checkConfigOutput '^1$' config.sub.specialisation.value ./extendModules-168767-i
|
||||
|
||||
# Class checks, evalModules
|
||||
checkConfigOutput '^{ }$' config.ok.config ./class-check.nix
|
||||
checkConfigOutput '"nixos"' config.ok.configurationClass ./class-check.nix
|
||||
checkConfigError 'The module .*/module-class-is-darwin.nix was imported into nixos instead of darwin.' config.fail.config ./class-check.nix
|
||||
checkConfigError 'The module foo.nix#darwinModules.default was imported into nixos instead of darwin.' config.fail-anon.config ./class-check.nix
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user