@@ -14,6 +14,7 @@ overrides:
1414fetchTreeFinal :
1515
1616let
17+ inherit ( builtins ) mapAttrs ;
1718
1819 lockFile = builtins . fromJSON lockFileStr ;
1920
3536 ( resolveInput lockFile . nodes . ${ nodeName } . inputs . ${ builtins . head path } )
3637 ( builtins . tail path ) ;
3738
38- allNodes = builtins . mapAttrs (
39+ allNodes = mapAttrs (
3940 key : node :
4041 let
4142
4243 parentNode = allNodes . ${ getInputByPath lockFile . root node . parent } ;
4344
45+ flakeDir =
46+ let
47+ dir = overrides . ${ key } . dir or node . locked . path or "" ;
48+ parentDir = parentNode . flakeDir ;
49+ in
50+ if node ? parent then parentDir + ( "/" + dir ) else dir ;
51+
4452 sourceInfo =
4553 if overrides ? ${ key } then
4654 overrides . ${ key } . sourceInfo
4755 else if node . locked . type == "path" && builtins . substring 0 1 node . locked . path != "/" then
4856 parentNode . sourceInfo
4957 // {
50- outPath = parentNode . outPath + ( "/" + node . locked . path ) ;
58+ outPath = parentNode . sourceInfo . outPath + ( "/" + flakeDir ) ;
5159 }
5260 else
5361 # FIXME: remove obsolete node.info.
6068
6169 flake = import ( outPath + "/flake.nix" ) ;
6270
63- inputs = builtins . mapAttrs ( inputName : inputSpec : allNodes . ${ resolveInput inputSpec } ) (
71+ inputs = mapAttrs ( inputName : inputSpec : allNodes . ${ resolveInput inputSpec } . result ) (
6472 node . inputs or { }
6573 ) ;
6674
8593 } ;
8694
8795 in
88- if node . flake or true then
89- assert builtins . isFunction flake . outputs ;
90- result
91- else
92- sourceInfo
96+ {
97+ result =
98+ if node . flake or true then
99+ assert builtins . isFunction flake . outputs ;
100+ result
101+ else
102+ sourceInfo ;
103+
104+ inherit flakeDir sourceInfo ;
105+ }
93106 ) lockFile . nodes ;
94107
95108in
96- allNodes . ${ lockFile . root }
109+ allNodes . ${ lockFile. root } . result
0 commit comments