1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-21 11:30:30 -04:00
nix/src/libexpr/flake/call-flake.nix

23 lines
640 B
Nix
Raw Normal View History

2020-03-10 14:21:47 -04:00
locks: rootSrc: rootSubdir:
let
2020-03-10 14:21:47 -04:00
callFlake = sourceInfo: subdir: locks:
let
2020-03-10 14:21:47 -04:00
flake = import (sourceInfo + "/" + subdir + "/flake.nix");
inputs = builtins.mapAttrs (n: v:
if v.flake or true
2020-03-10 14:21:47 -04:00
then callFlake (fetchTree (removeAttrs v.locked ["dir"])) (v.locked.dir or "") v.inputs
else fetchTree v.locked) locks;
outputs = flake.outputs (inputs // { self = result; });
result = outputs // sourceInfo // { inherit inputs; inherit outputs; inherit sourceInfo; };
in
assert flake.edition == 201909;
result;
2020-03-10 14:21:47 -04:00
in callFlake rootSrc rootSubdir (builtins.fromJSON locks).inputs