diff options
-rw-r--r-- | corepkgs/call-flake.nix | 10 | ||||
-rw-r--r-- | src/libexpr/flake/flake.cc | 11 | ||||
-rw-r--r-- | src/libexpr/primops/fetchTree.cc | 1 |
3 files changed, 14 insertions, 8 deletions
diff --git a/corepkgs/call-flake.nix b/corepkgs/call-flake.nix index 29ff41040..c59a0c75f 100644 --- a/corepkgs/call-flake.nix +++ b/corepkgs/call-flake.nix @@ -1,14 +1,14 @@ -locks: rootSrc: +locks: rootSrc: rootSubdir: let - callFlake = sourceInfo: locks: + callFlake = sourceInfo: subdir: locks: let - flake = import (sourceInfo + "/flake.nix"); + flake = import (sourceInfo + "/" + subdir + "/flake.nix"); inputs = builtins.mapAttrs (n: v: if v.flake or true - then callFlake (fetchTree v.locked) v.inputs + then callFlake (fetchTree (removeAttrs v.locked ["dir"])) (v.locked.dir or "") v.inputs else fetchTree v.locked) locks; outputs = flake.outputs (inputs // { self = result; }); @@ -19,4 +19,4 @@ let result; -in callFlake rootSrc (builtins.fromJSON locks).inputs +in callFlake rootSrc rootSubdir (builtins.fromJSON locks).inputs diff --git a/src/libexpr/flake/flake.cc b/src/libexpr/flake/flake.cc index eac7d026d..9d8a5f950 100644 --- a/src/libexpr/flake/flake.cc +++ b/src/libexpr/flake/flake.cc @@ -626,15 +626,20 @@ void callFlake(EvalState & state, auto vCallFlake = state.allocValue(); auto vLocks = state.allocValue(); auto vRootSrc = state.allocValue(); - auto vTmp = state.allocValue(); + auto vRootSubdir = state.allocValue(); + auto vTmp1 = state.allocValue(); + auto vTmp2 = state.allocValue(); mkString(*vLocks, lockedInputs.to_string()); emitTreeAttrs(state, *flake.sourceInfo, flake.lockedRef.input, *vRootSrc); + mkString(*vRootSubdir, flake.lockedRef.subdir); + state.evalFile(canonPath(settings.nixDataDir + "/nix/corepkgs/call-flake.nix", true), *vCallFlake); - state.callFunction(*vCallFlake, *vLocks, *vTmp, noPos); - state.callFunction(*vTmp, *vRootSrc, vRes, noPos); + state.callFunction(*vCallFlake, *vLocks, *vTmp1, noPos); + state.callFunction(*vTmp1, *vRootSrc, *vTmp2, noPos); + state.callFunction(*vTmp2, *vRootSubdir, vRes, noPos); } void callFlake(EvalState & state, diff --git a/src/libexpr/primops/fetchTree.cc b/src/libexpr/primops/fetchTree.cc index 66994c823..47667a1b8 100644 --- a/src/libexpr/primops/fetchTree.cc +++ b/src/libexpr/primops/fetchTree.cc @@ -76,6 +76,7 @@ static void prim_fetchTree(EvalState & state, const Pos & pos, Value * * args, V if (evalSettings.pureEval && !input->isImmutable()) throw Error("in pure evaluation mode, 'fetchTree' requires an immutable input"); + // FIXME: use fetchOrSubstituteTree auto [tree, input2] = input->fetchTree(state.store); if (state.allowedPaths) |