Move call-flake.nix into libexpr

This commit is contained in:
Eelco Dolstra 2020-03-11 16:34:46 +01:00
parent 35f6651735
commit e188fe7c6d
5 changed files with 13 additions and 5 deletions

View File

@ -1,8 +1,7 @@
corepkgs_FILES = \ corepkgs_FILES = \
unpack-channel.nix \ unpack-channel.nix \
derivation.nix \ derivation.nix \
fetchurl.nix \ fetchurl.nix
call-flake.nix
$(foreach file,config.nix $(corepkgs_FILES),$(eval $(call install-data-in,$(d)/$(file),$(datadir)/nix/corepkgs))) $(foreach file,config.nix $(corepkgs_FILES),$(eval $(call install-data-in,$(d)/$(file),$(datadir)/nix/corepkgs)))

View File

@ -623,7 +623,6 @@ void callFlake(EvalState & state,
const LockedInputs & lockedInputs, const LockedInputs & lockedInputs,
Value & vRes) Value & vRes)
{ {
auto vCallFlake = state.allocValue();
auto vLocks = state.allocValue(); auto vLocks = state.allocValue();
auto vRootSrc = state.allocValue(); auto vRootSrc = state.allocValue();
auto vRootSubdir = state.allocValue(); auto vRootSubdir = state.allocValue();
@ -636,7 +635,15 @@ void callFlake(EvalState & state,
mkString(*vRootSubdir, flake.lockedRef.subdir); 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(*vCallFlake, *vLocks, *vTmp1, noPos);
state.callFunction(*vTmp1, *vRootSrc, *vTmp2, noPos); state.callFunction(*vTmp1, *vRootSrc, *vTmp2, noPos);
state.callFunction(*vTmp2, *vRootSubdir, vRes, noPos); state.callFunction(*vTmp2, *vRootSubdir, vRes, noPos);

View File

@ -41,3 +41,5 @@ $(foreach i, $(wildcard src/libexpr/flake/*.hh), \
$(eval $(call install-file-in, $(i), $(includedir)/nix/flake, 0644))) $(eval $(call install-file-in, $(i), $(includedir)/nix/flake, 0644)))
$(d)/primops.cc: $(d)/imported-drv-to-derivation.nix.gen.hh $(d)/primops.cc: $(d)/imported-drv-to-derivation.nix.gen.hh
$(d)/flake/flake.cc: $(d)/flake/call-flake.nix.gen.hh

View File

@ -343,7 +343,7 @@ void LocalStore::openDB(State & state, bool create)
/* Initialise the database schema, if necessary. */ /* Initialise the database schema, if necessary. */
if (create) { if (create) {
const char * schema = static const char schema[] =
#include "schema.sql.gen.hh" #include "schema.sql.gen.hh"
; ;
db.exec(schema); db.exec(schema);