summary refs log tree commit diff
path: root/lib/types.nix
diff options
context:
space:
mode:
authorSilvan Mosberger <contact@infinisil.com>2019-12-31 04:25:35 +0100
committerSilvan Mosberger <contact@infinisil.com>2020-01-02 09:59:35 +0100
commiteec83d41e3e7d9ad5bc1086198d972d55bab1203 (patch)
treeb2118c45cb47ef7c239990ae72566d6ffbb6cdec /lib/types.nix
parentbc42515736154efd577baafa592734ff1bc198bc (diff)
downloadnixpkgs-eec83d41e3e7d9ad5bc1086198d972d55bab1203.tar
nixpkgs-eec83d41e3e7d9ad5bc1086198d972d55bab1203.tar.gz
nixpkgs-eec83d41e3e7d9ad5bc1086198d972d55bab1203.tar.bz2
nixpkgs-eec83d41e3e7d9ad5bc1086198d972d55bab1203.tar.lz
nixpkgs-eec83d41e3e7d9ad5bc1086198d972d55bab1203.tar.xz
nixpkgs-eec83d41e3e7d9ad5bc1086198d972d55bab1203.tar.zst
nixpkgs-eec83d41e3e7d9ad5bc1086198d972d55bab1203.zip
lib/types: Allow paths as submodule values
Diffstat (limited to 'lib/types.nix')
-rw-r--r--lib/types.nix8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/types.nix b/lib/types.nix
index de3c4f0d603..847a4e902ca 100644
--- a/lib/types.nix
+++ b/lib/types.nix
@@ -376,14 +376,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;