lib.deferredModule: Make it properly singular
This commit is contained in:
parent
19a069ab8b
commit
dfd98a5da2
4 changed files with 19 additions and 12 deletions
|
@ -12,7 +12,7 @@ in
|
||||||
({ config, ... }: {
|
({ config, ... }: {
|
||||||
_file = "generic.nix";
|
_file = "generic.nix";
|
||||||
options.nodes = mkOption {
|
options.nodes = mkOption {
|
||||||
type = lazyAttrsOf (submodule { imports = config.default; });
|
type = lazyAttrsOf (submodule { imports = [ config.default ]; });
|
||||||
default = {};
|
default = {};
|
||||||
};
|
};
|
||||||
options.default = mkOption {
|
options.default = mkOption {
|
||||||
|
|
|
@ -549,7 +549,9 @@ rec {
|
||||||
name = "deferredModule";
|
name = "deferredModule";
|
||||||
description = "module";
|
description = "module";
|
||||||
check = x: isAttrs x || isFunction x || path.check x;
|
check = x: isAttrs x || isFunction x || path.check x;
|
||||||
merge = loc: defs: staticModules ++ map (def: lib.setDefaultModuleLocation "${def.file}, via option ${showOption loc}" def.value) defs;
|
merge = loc: defs: {
|
||||||
|
imports = staticModules ++ map (def: lib.setDefaultModuleLocation "${def.file}, via option ${showOption loc}" def.value) defs;
|
||||||
|
};
|
||||||
inherit (submoduleWith { modules = staticModules; })
|
inherit (submoduleWith { modules = staticModules; })
|
||||||
getSubOptions
|
getSubOptions
|
||||||
getSubModules;
|
getSubModules;
|
||||||
|
|
|
@ -227,8 +227,9 @@ Value types are types that take a value parameter.
|
||||||
|
|
||||||
It can be set multiple times.
|
It can be set multiple times.
|
||||||
|
|
||||||
Module authors can use its value, which is always a list of module values,
|
Module authors can use its value in `imports`, in `submoduleWith`'s `modules`
|
||||||
in `imports` or in `submoduleWith`'s `modules` parameter.
|
or in `evalModules`' `modules` parameter, among other places.
|
||||||
|
|
||||||
Note that `imports` must be evaluated before the module fixpoint. Because
|
Note that `imports` must be evaluated before the module fixpoint. Because
|
||||||
of this, deferred modules can only be imported into "other" fixpoints, such
|
of this, deferred modules can only be imported into "other" fixpoints, such
|
||||||
as submodules.
|
as submodules.
|
||||||
|
|
|
@ -441,14 +441,18 @@
|
||||||
It can be set multiple times.
|
It can be set multiple times.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
Module authors can use its value, which is always a list of
|
Module authors can use its value in
|
||||||
module values, in <literal>imports</literal> or in
|
<literal>imports</literal>, in
|
||||||
<literal>submoduleWith</literal>’s
|
<literal>submoduleWith</literal><quote>s
|
||||||
<literal>modules</literal> parameter. Note that
|
<literal>modules</literal> or in
|
||||||
<literal>imports</literal> must be evaluated before the
|
<literal>evalModules</literal></quote>
|
||||||
module fixpoint. Because of this, deferred modules can only
|
<literal>modules</literal> parameter, among other places.
|
||||||
be imported into <quote>other</quote> fixpoints, such as
|
</para>
|
||||||
submodules.
|
<para>
|
||||||
|
Note that <literal>imports</literal> must be evaluated
|
||||||
|
before the module fixpoint. Because of this, deferred
|
||||||
|
modules can only be imported into <quote>other</quote>
|
||||||
|
fixpoints, such as submodules.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
One use case for this type is the type of a
|
One use case for this type is the type of a
|
||||||
|
|
Loading…
Reference in a new issue