aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--corepkgs/local.mk3
-rw-r--r--src/libexpr/flake/call-flake.nix (renamed from corepkgs/call-flake.nix)0
-rw-r--r--src/libexpr/flake/flake.cc11
-rw-r--r--src/libexpr/local.mk2
-rw-r--r--src/libstore/local-store.cc2
5 files changed, 13 insertions, 5 deletions
diff --git a/corepkgs/local.mk b/corepkgs/local.mk
index 900781fdd..2c72d3a31 100644
--- a/corepkgs/local.mk
+++ b/corepkgs/local.mk
@@ -1,8 +1,7 @@
corepkgs_FILES = \
unpack-channel.nix \
derivation.nix \
- fetchurl.nix \
- call-flake.nix
+ fetchurl.nix
$(foreach file,config.nix $(corepkgs_FILES),$(eval $(call install-data-in,$(d)/$(file),$(datadir)/nix/corepkgs)))
diff --git a/corepkgs/call-flake.nix b/src/libexpr/flake/call-flake.nix
index c59a0c75f..c59a0c75f 100644
--- a/corepkgs/call-flake.nix
+++ b/src/libexpr/flake/call-flake.nix
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);
diff --git a/src/libexpr/local.mk b/src/libexpr/local.mk
index d1982927c..eb7243b29 100644
--- a/src/libexpr/local.mk
+++ b/src/libexpr/local.mk
@@ -41,3 +41,5 @@ $(foreach i, $(wildcard src/libexpr/flake/*.hh), \
$(eval $(call install-file-in, $(i), $(includedir)/nix/flake, 0644)))
$(d)/primops.cc: $(d)/imported-drv-to-derivation.nix.gen.hh
+
+$(d)/flake/flake.cc: $(d)/flake/call-flake.nix.gen.hh
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index e00556645..2025af33e 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -343,7 +343,7 @@ void LocalStore::openDB(State & state, bool create)
/* Initialise the database schema, if necessary. */
if (create) {
- const char * schema =
+ static const char schema[] =
#include "schema.sql.gen.hh"
;
db.exec(schema);