update lix

This commit is contained in:
leo60228 2024-11-29 16:52:37 -05:00
parent dfc286ca3d
commit 316f6a7ff9
Signed by: vriska
GPG key ID: 6F3EB461799AD95E
5 changed files with 26 additions and 20 deletions

View file

@ -47,11 +47,11 @@
"pre-commit-hooks": "pre-commit-hooks"
},
"locked": {
"lastModified": 1732112222,
"narHash": "sha256-H7GN4++a4vE49SUNojZx+FSk4mmpb2ifJUtJMJHProI=",
"rev": "66f6dbda32959dd5cf3a9aaba15af72d037ab7ff",
"lastModified": 1732899308,
"narHash": "sha256-1jsQqcbMbaWuFim3sqEUdB1/E2KqHa0+cHbTzd/GYFE=",
"rev": "2e5780ebc848f3b021f11dd94533b0b68362d989",
"type": "tarball",
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/66f6dbda32959dd5cf3a9aaba15af72d037ab7ff.tar.gz?rev=66f6dbda32959dd5cf3a9aaba15af72d037ab7ff"
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/2e5780ebc848f3b021f11dd94533b0b68362d989.tar.gz?rev=2e5780ebc848f3b021f11dd94533b0b68362d989"
},
"original": {
"type": "tarball",

View file

@ -63,8 +63,7 @@ Drv::Drv(std::string &attrPath, nix::EvalState &state, nix::DrvInfo &drvInfo,
}
}
} catch (const std::exception &e) {
throw nix::EvalError(state,
"derivation '%s' does not have valid outputs: %s",
throw nix::EvalError("derivation '%s' does not have valid outputs: %s",
attrPath, e.what());
}

View file

@ -3,6 +3,7 @@
#include <lix/libexpr/eval-settings.hh>
#include <lix/libmain/shared.hh>
#include <lix/libutil/sync.hh>
#include <lix/libexpr/eval-cache.hh>
#include <lix/libexpr/eval.hh>
#include <lix/libutil/signals.hh>
#include <sys/wait.h>
@ -47,8 +48,9 @@ using namespace nlohmann;
static MyArgs myArgs;
typedef std::function<void(ref<EvalState> state, Bindings &autoArgs,
AutoCloseFD &to, AutoCloseFD &from, MyArgs &args)>
typedef std::function<void(ref<eval_cache::CachingEvalState> state,
Bindings &autoArgs, AutoCloseFD &to,
AutoCloseFD &from, MyArgs &args)>
Processor;
/* Auto-cleanup of fork's process and fds. */
@ -70,10 +72,11 @@ struct Proc {
auto evalStore = myArgs.evalStoreUrl
? openStore(*myArgs.evalStoreUrl)
: openStore();
auto state = std::make_shared<EvalState>(myArgs.searchPath,
evalStore);
auto state = std::make_shared<eval_cache::CachingEvalState>(
myArgs.searchPath, evalStore);
Bindings &autoArgs = *myArgs.getAutoArgs(*state);
proc(ref<EvalState>(state), autoArgs, *to, *from, myArgs);
proc(ref<eval_cache::CachingEvalState>(state), autoArgs,
*to, *from, myArgs);
} catch (Error &e) {
nlohmann::json err;
auto msg = e.msg();

View file

@ -14,6 +14,7 @@
#include <lix/libutil/canon-path.hh>
#include <lix/libcmd/common-eval-args.hh>
#include <lix/libutil/error.hh>
#include <lix/libexpr/eval-cache.hh>
#include <lix/libexpr/eval-inline.hh>
#include <lix/libexpr/eval.hh>
#include <lix/libexpr/flake/flakeref.hh>
@ -49,13 +50,13 @@ static nix::Value *releaseExprTopLevelValue(nix::EvalState &state,
if (args.fromArgs) {
nix::Expr &e = state.parseExprFromString(
args.releaseExpr, state.rootPath(nix::CanonPath::fromCwd()));
args.releaseExpr, nix::CanonPath::fromCwd());
state.eval(e, vTop);
} else {
state.evalFile(lookupFileArg(state, args.releaseExpr), vTop);
}
auto vRoot = state.allocValue();
auto vRoot = state.mem.allocValue();
state.autoCallFunction(autoArgs, vTop, *vRoot);
@ -73,8 +74,9 @@ static std::string attrPathJoin(nlohmann::json input) {
});
}
void worker(nix::ref<nix::EvalState> state, nix::Bindings &autoArgs,
nix::AutoCloseFD &to, nix::AutoCloseFD &from, MyArgs &args) {
void worker(nix::ref<nix::eval_cache::CachingEvalState> state,
nix::Bindings &autoArgs, nix::AutoCloseFD &to,
nix::AutoCloseFD &from, MyArgs &args) {
nix::Value *vRoot = [&]() {
if (args.flake) {
@ -85,7 +87,7 @@ void worker(nix::ref<nix::EvalState> state, nix::Bindings &autoArgs,
{}, state, std::move(flakeRef), fragment, outputSpec,
{}, {}, args.lockFlags};
return flake.toValue(*state).first;
return flake.toValue().first;
} else {
return releaseExprTopLevelValue(*state, autoArgs, args);
}
@ -119,7 +121,7 @@ void worker(nix::ref<nix::EvalState> state, nix::Bindings &autoArgs,
nix::findAlongAttrPath(*state, attrPathS, autoArgs, *vRoot)
.first;
auto v = state->allocValue();
auto v = state->mem.allocValue();
state->autoCallFunction(autoArgs, *vTmp, *v);
if (v->type() == nix::nAttrs) {
@ -158,7 +160,7 @@ void worker(nix::ref<nix::EvalState> state, nix::Bindings &autoArgs,
if (name == "recurseForDerivations" &&
!args.forceRecurse) {
auto attrv =
v->attrs->get(state->sRecurseForDerivations);
v->attrs->get(state->s.recurseForDerivations);
recurse = state->forceBool(
*attrv->value, attrv->pos,
"while evaluating recurseForDerivations");

View file

@ -1,5 +1,6 @@
#pragma once
#include <lix/libmain/shared.hh>
#include <lix/libexpr/eval-cache.hh>
#include <lix/libexpr/eval.hh>
#include "eval-args.hh"
@ -13,5 +14,6 @@ class EvalState;
template <typename T> class ref;
} // namespace nix
void worker(nix::ref<nix::EvalState> state, nix::Bindings &autoArgs,
nix::AutoCloseFD &to, nix::AutoCloseFD &from, MyArgs &args);
void worker(nix::ref<nix::eval_cache::CachingEvalState> state,
nix::Bindings &autoArgs, nix::AutoCloseFD &to,
nix::AutoCloseFD &from, MyArgs &args);