From 316f6a7ff90303d032155229c30c0bef69159a2c 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 dca58de..f5b0304 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 2b4885e..f68ee15 100644 --- a/src/nix-eval-jobs.cc +++ b/src/nix-eval-jobs.cc @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -47,8 +48,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. */ @@ -70,10 +72,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 5e5ff9f..b9ba623 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) { @@ -158,7 +160,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);