mirror of
https://github.com/NixOS/nix
synced 2025-07-03 02:01:48 +02:00
Move call-flake.nix into libexpr
This commit is contained in:
parent
35f6651735
commit
e188fe7c6d
5 changed files with 13 additions and 5 deletions
22
src/libexpr/flake/call-flake.nix
Normal file
22
src/libexpr/flake/call-flake.nix
Normal file
|
@ -0,0 +1,22 @@
|
|||
locks: rootSrc: rootSubdir:
|
||||
|
||||
let
|
||||
|
||||
callFlake = sourceInfo: subdir: locks:
|
||||
let
|
||||
flake = import (sourceInfo + "/" + subdir + "/flake.nix");
|
||||
|
||||
inputs = builtins.mapAttrs (n: v:
|
||||
if v.flake or true
|
||||
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;
|
||||
|
||||
in callFlake rootSrc rootSubdir (builtins.fromJSON locks).inputs
|
Loading…
Add table
Add a link
Reference in a new issue