diff options
author | Robert Hensing <roberth@users.noreply.github.com> | 2020-01-12 14:19:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-12 14:19:04 +0100 |
commit | 9884cb3ed004984696a64915849afe175ac5c597 (patch) | |
tree | 6a6b40e2d3abaa9d552f6d3fdffebd07f3bfbeb4 /lib/types.nix | |
parent | a23a985594bf7c3eb543bdaf1e7a9c5b6ddd6099 (diff) | |
parent | 9d4b59b54949f0849ab9db9d30bc4cce7a205787 (diff) |
Merge pull request #76861 from Infinisil/paths-as-submodules
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 e86f6d364761..e6f841766570 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -430,14 +430,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; |