summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorAlan Pearce2024-05-30 17:29:18 +0200
committerAlan Pearce2024-05-30 17:29:18 +0200
commit802741a5292636b9a1619c712e128a77976e9d31 (patch)
treefaffbe342dda061f0afdb21eace0d5bc8a768d6f /lib
parent15062a1bf490549f2c2a70938f6ff3a1bcbe2650 (diff)
downloadnixfiles-802741a5292636b9a1619c712e128a77976e9d31.tar.lz
nixfiles-802741a5292636b9a1619c712e128a77976e9d31.tar.zst
nixfiles-802741a5292636b9a1619c712e128a77976e9d31.zip
add local submodules to nix path
Diffstat (limited to 'lib')
-rw-r--r--lib/default.nix17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/default.nix b/lib/default.nix
index a02fe34b..2cbaf55c 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -7,12 +7,19 @@ rec {
   importPathStore = p: "${append ../. "/${p}"}";
 
   mkPathable = s: toString (
-    if s.type == "local"
-    then (lib.path.append ../. s.outPath)
-    else s.outPath
+    if lib.path.subpath.isValid s
+    then (lib.path.append ../. s)
+    else s
   );
 
+  kvPath = k: v: "${k}=${v}";
+
+  fromSources = sources:
+    lib.attrsets.mapAttrs
+      (k: v: v.outPath)
+      sources;
+
   mkNixPath = sources: lib.attrsets.mapAttrsToList
-    (k: v: "${k}=${mkPathable v}")
-    (removeAttrs sources [ "__functor" ]);
+    (k: v: kvPath k (mkPathable v))
+    sources;
 }