aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/flake/flake.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-03-11 16:34:46 +0100
committerEelco Dolstra <edolstra@gmail.com>2020-03-11 17:04:51 +0100
commite188fe7c6d4b243ed62ca3d0e47abfd0eec95f79 (patch)
tree4fbb0a36dd2a295930abe9c1a3722350de48926e /src/libexpr/flake/flake.cc
parent35f66517350402792aded1b677a47526e23e78ef (diff)
Move call-flake.nix into libexpr
Diffstat (limited to 'src/libexpr/flake/flake.cc')
-rw-r--r--src/libexpr/flake/flake.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/libexpr/flake/flake.cc b/src/libexpr/flake/flake.cc
index 9d8a5f950..249ceba6c 100644
--- a/src/libexpr/flake/flake.cc
+++ b/src/libexpr/flake/flake.cc
@@ -623,7 +623,6 @@ void callFlake(EvalState & state,
const LockedInputs & lockedInputs,
Value & vRes)
{
- auto vCallFlake = state.allocValue();
auto vLocks = state.allocValue();
auto vRootSrc = state.allocValue();
auto vRootSubdir = state.allocValue();
@@ -636,7 +635,15 @@ void callFlake(EvalState & state,
mkString(*vRootSubdir, flake.lockedRef.subdir);
- state.evalFile(canonPath(settings.nixDataDir + "/nix/corepkgs/call-flake.nix", true), *vCallFlake);
+ static Value * vCallFlake = nullptr;
+
+ if (!vCallFlake) {
+ vCallFlake = state.allocValue();
+ state.eval(state.parseExprFromString(
+ #include "call-flake.nix.gen.hh"
+ , "/"), *vCallFlake);
+ }
+
state.callFunction(*vCallFlake, *vLocks, *vTmp1, noPos);
state.callFunction(*vTmp1, *vRootSrc, *vTmp2, noPos);
state.callFunction(*vTmp2, *vRootSubdir, vRes, noPos);