mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
lib.deferredModule: Make it properly singular
This commit is contained in:
parent
19a069ab8b
commit
dfd98a5da2
@ -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 {
|
||||
|
@ -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;
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user