3
0
Fork 0
forked from mirrors/nixpkgs

lib.deferredModule: Make it properly singular

This commit is contained in:
Robert Hensing 2022-06-14 02:12:43 +02:00
parent 19a069ab8b
commit dfd98a5da2
4 changed files with 19 additions and 12 deletions

View file

@ -12,7 +12,7 @@ in
({ config, ... }: {
_file = "generic.nix";
options.nodes = mkOption {
type = lazyAttrsOf (submodule { imports = config.default; });
type = lazyAttrsOf (submodule { imports = [ config.default ]; });
default = {};
};
options.default = mkOption {

View file

@ -549,7 +549,9 @@ rec {
name = "deferredModule";
description = "module";
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; })
getSubOptions
getSubModules;

View file

@ -227,8 +227,9 @@ Value types are types that take a value parameter.
It can be set multiple times.
Module authors can use its value, which is always a list of module values,
in `imports` or in `submoduleWith`'s `modules` parameter.
Module authors can use its value in `imports`, in `submoduleWith`'s `modules`
or in `evalModules`' `modules` parameter, among other places.
Note that `imports` must be evaluated before the module fixpoint. Because
of this, deferred modules can only be imported into "other" fixpoints, such
as submodules.

View file

@ -441,14 +441,18 @@
It can be set multiple times.
</para>
<para>
Module authors can use its value, which is always a list of
module values, in <literal>imports</literal> or in
<literal>submoduleWith</literal>s
<literal>modules</literal> parameter. 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.
Module authors can use its value in
<literal>imports</literal>, in
<literal>submoduleWith</literal><quote>s
<literal>modules</literal> or in
<literal>evalModules</literal></quote>
<literal>modules</literal> parameter, among other places.
</para>
<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>
One use case for this type is the type of a