diff options
author | Silvan Mosberger <contact@infinisil.com> | 2020-01-03 05:22:11 +0100 |
---|---|---|
committer | Silvan Mosberger <contact@infinisil.com> | 2020-01-08 23:54:45 +0100 |
commit | 6525da6321a7272faa0c2b1c15ffd3501888e9b9 (patch) | |
tree | f8288ac36e592287aa0e068f5153f8a3e9d53745 /lib/types.nix | |
parent | 228a7b173e659a10c0f288f44e18e7ae050c78cb (diff) |
lib/types: Allow paths as submodule values
Diffstat (limited to 'lib/types.nix')
-rw-r--r-- | lib/types.nix | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/types.nix b/lib/types.nix index 4872a67665716..7f2401c53d310 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -392,14 +392,16 @@ rec { else unify (if shorthandOnlyDefinesConfig then { config = value; } else value); allModules = defs: modules ++ imap1 (n: { value, file }: - # Annotate the value with the location of its definition for better error messages - coerce (lib.modules.unifyModuleSyntax file "${toString file}-${toString n}") value + if isAttrs value || isFunction value then + # Annotate the value with the location of its definition for better error messages + coerce (lib.modules.unifyModuleSyntax file "${toString file}-${toString n}") value + else value ) defs; in mkOptionType rec { name = "submodule"; - check = x: isAttrs x || isFunction x; + check = x: isAttrs x || isFunction x || path.check x; merge = loc: defs: (evalModules { modules = allModules defs; |