From 9c5c88d57b33a37434c7ad94a3d97b7b8afb67b9 Mon Sep 17 00:00:00 2001 From: leo60228 Date: Fri, 29 Nov 2024 16:52:37 -0500 Subject: [PATCH] update lix --- flake.lock | 8 ++++---- src/drv.cc | 3 +-- src/nix-eval-jobs.cc | 13 ++++++++----- src/worker.cc | 16 +++++++++------- src/worker.hh | 6 ++++-- 5 files changed, 26 insertions(+), 20 deletions(-) diff --git a/flake.lock b/flake.lock index cf03d2a..2030554 100644 --- a/flake.lock +++ b/flake.lock @@ -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", diff --git a/src/drv.cc b/src/drv.cc index 7e490c9..15bc6dc 100644 --- a/src/drv.cc +++ b/src/drv.cc @@ -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()); } diff --git a/src/nix-eval-jobs.cc b/src/nix-eval-jobs.cc index 2014013..b060943 100644 --- a/src/nix-eval-jobs.cc +++ b/src/nix-eval-jobs.cc @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -49,8 +50,9 @@ using namespace nlohmann; static MyArgs myArgs; -typedef std::function state, Bindings &autoArgs, - AutoCloseFD &to, AutoCloseFD &from, MyArgs &args)> +typedef std::function state, + Bindings &autoArgs, AutoCloseFD &to, + AutoCloseFD &from, MyArgs &args)> Processor; /* Auto-cleanup of fork's process and fds. */ @@ -72,10 +74,11 @@ struct Proc { auto evalStore = myArgs.evalStoreUrl ? openStore(*myArgs.evalStoreUrl) : openStore(); - auto state = std::make_shared(myArgs.searchPath, - evalStore); + auto state = std::make_shared( + myArgs.searchPath, evalStore); Bindings &autoArgs = *myArgs.getAutoArgs(*state); - proc(ref(state), autoArgs, *to, *from, myArgs); + proc(ref(state), autoArgs, + *to, *from, myArgs); } catch (Error &e) { nlohmann::json err; auto msg = e.msg(); diff --git a/src/worker.cc b/src/worker.cc index f429e1a..aa3fa4d 100644 --- a/src/worker.cc +++ b/src/worker.cc @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -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 state, nix::Bindings &autoArgs, - nix::AutoCloseFD &to, nix::AutoCloseFD &from, MyArgs &args) { +void worker(nix::ref 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 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 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) { @@ -191,7 +193,7 @@ void worker(nix::ref 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"); diff --git a/src/worker.hh b/src/worker.hh index caf4200..7eec3de 100644 --- a/src/worker.hh +++ b/src/worker.hh @@ -1,5 +1,6 @@ #pragma once #include +#include #include #include "eval-args.hh" @@ -13,5 +14,6 @@ class EvalState; template class ref; } // namespace nix -void worker(nix::ref state, nix::Bindings &autoArgs, - nix::AutoCloseFD &to, nix::AutoCloseFD &from, MyArgs &args); +void worker(nix::ref state, + nix::Bindings &autoArgs, nix::AutoCloseFD &to, + nix::AutoCloseFD &from, MyArgs &args);