Revert "lib/types: Allow paths as submodule values"

This reverts commit eec83d41e3.

This broke hydra evaluation because with this commit submodule values
are allowed to be paths, however the certmgr module uses `either
(submodule ...) path` in its type, meaning it already used paths for
something else which would now be interpreted as a submodule.
This commit is contained in:
Silvan Mosberger 2020-01-03 05:17:13 +01:00
parent 804678f9ea
commit c7ade6844f
No known key found for this signature in database
GPG Key ID: E8F1E9EAD284E17D
2 changed files with 6 additions and 8 deletions

View File

@ -376,16 +376,14 @@ rec {
else unify (if shorthandOnlyDefinesConfig then { config = value; } else value); else unify (if shorthandOnlyDefinesConfig then { config = value; } else value);
allModules = defs: modules ++ imap1 (n: { value, file }: allModules = defs: modules ++ imap1 (n: { value, file }:
if isAttrs value || isFunction value then # Annotate the value with the location of its definition for better error messages
# Annotate the value with the location of its definition for better error messages coerce (lib.modules.unifyModuleSyntax file "${toString file}-${toString n}") value
coerce (lib.modules.unifyModuleSyntax file "${toString file}-${toString n}") value
else value
) defs; ) defs;
in in
mkOptionType rec { mkOptionType rec {
name = "submodule"; name = "submodule";
check = x: isAttrs x || isFunction x || path.check x; check = x: isAttrs x || isFunction x;
merge = loc: defs: merge = loc: defs:
(evalModules { (evalModules {
modules = allModules defs; modules = allModules defs;

View File

@ -257,9 +257,9 @@
<listitem> <listitem>
<para> <para>
A set of sub options <replaceable>o</replaceable>. A set of sub options <replaceable>o</replaceable>.
<replaceable>o</replaceable> can be an attribute set, a function <replaceable>o</replaceable> can be an attribute set or a function
returning an attribute set, or a path to a file containing such a value. Submodules are used in returning an attribute set. Submodules are used in composed types to
composed types to create modular options. This is equivalent to create modular options. This is equivalent to
<literal>types.submoduleWith { modules = toList o; shorthandOnlyDefinesConfig = true; }</literal>. <literal>types.submoduleWith { modules = toList o; shorthandOnlyDefinesConfig = true; }</literal>.
Submodules are detailed in Submodules are detailed in
<xref <xref