lib.modules: Add _prefix module argument
This commit is contained in:
@@ -258,6 +258,7 @@ let
|
||||
specialArgs
|
||||
;
|
||||
_class = class;
|
||||
_prefix = prefix;
|
||||
}
|
||||
// specialArgs
|
||||
);
|
||||
|
||||
@@ -352,6 +352,9 @@ checkConfigOutput '^"submodule"$' options.submodule.type.description ./declare-s
|
||||
## Paths should be allowed as values and work as expected
|
||||
checkConfigOutput '^true$' config.submodule.enable ./declare-submoduleWith-path.nix
|
||||
|
||||
## _prefix module argument is available at import time and contains the prefix
|
||||
checkConfigOutput '^true$' config.foo.ok ./prefix-module-argument.nix
|
||||
|
||||
## deferredModule
|
||||
# default module is merged into nodes.foo
|
||||
checkConfigOutput '"beta"' config.nodes.foo.settingsDict.c ./deferred-module.nix
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
options.foo = lib.mkOption {
|
||||
type = lib.types.submodule { };
|
||||
default = { };
|
||||
};
|
||||
|
||||
config = {
|
||||
foo =
|
||||
{ _prefix, ... }:
|
||||
assert _prefix == [ "foo" ];
|
||||
{
|
||||
options.ok = lib.mkOption { };
|
||||
config.ok = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user