2020-03-12 21:06:57 +00:00
|
|
|
lockFileStr: rootSrc: rootSubdir:
|
2020-03-09 14:28:41 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
|
2020-03-12 21:06:57 +00:00
|
|
|
lockFile = builtins.fromJSON lockFileStr;
|
2020-03-09 14:28:41 +00:00
|
|
|
|
2020-03-12 21:06:57 +00:00
|
|
|
allNodes =
|
|
|
|
builtins.mapAttrs
|
|
|
|
(key: node:
|
|
|
|
let
|
2020-04-02 17:04:33 +00:00
|
|
|
sourceInfo =
|
|
|
|
if key == lockFile.root
|
|
|
|
then rootSrc
|
|
|
|
else fetchTree ({ inherit (node.info) narHash; } // removeAttrs node.locked ["dir"]);
|
2020-03-12 21:06:57 +00:00
|
|
|
subdir = if key == lockFile.root then rootSubdir else node.locked.dir or "";
|
|
|
|
flake = import (sourceInfo + (if subdir != "" then "/" else "") + subdir + "/flake.nix");
|
|
|
|
inputs = builtins.mapAttrs (inputName: key: allNodes.${key}) (node.inputs or {});
|
|
|
|
outputs = flake.outputs (inputs // { self = result; });
|
|
|
|
result = outputs // sourceInfo // { inherit inputs; inherit outputs; inherit sourceInfo; };
|
|
|
|
in
|
|
|
|
if node.flake or true then
|
|
|
|
assert builtins.isFunction flake.outputs;
|
|
|
|
result
|
|
|
|
else
|
|
|
|
sourceInfo
|
|
|
|
)
|
|
|
|
lockFile.nodes;
|
2020-03-09 14:28:41 +00:00
|
|
|
|
2020-03-12 21:06:57 +00:00
|
|
|
in allNodes.${lockFile.root}
|