Compare commits
No commits in common. "main" and "main" have entirely different histories.
7 changed files with 70 additions and 84 deletions
44
flake.lock
44
flake.lock
|
@ -23,11 +23,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1730504689,
|
"lastModified": 1717285511,
|
||||||
"narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=",
|
"narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-parts",
|
"repo": "flake-parts",
|
||||||
"rev": "506278e768c2a08bec68eb62932193e341f55c90",
|
"rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -47,11 +47,11 @@
|
||||||
"pre-commit-hooks": "pre-commit-hooks"
|
"pre-commit-hooks": "pre-commit-hooks"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1733448312,
|
"lastModified": 1719348166,
|
||||||
"narHash": "sha256-id5U81bzXk/Lg900nGLM4CQb0wmTdzIvQz7CZk2OcTM=",
|
"narHash": "sha256-GK6PusfbMgkg+qdgChmrw78KTNQkm7SDoJ6+lJKY6vg=",
|
||||||
"rev": "2a9e560570982a91937d199af3e7b7a8f3cbe14b",
|
"rev": "f170870ae7b18c8ee13fb42fe19b5aa05ddf56c0",
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/2a9e560570982a91937d199af3e7b7a8f3cbe14b.tar.gz?rev=2a9e560570982a91937d199af3e7b7a8f3cbe14b"
|
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/f170870ae7b18c8ee13fb42fe19b5aa05ddf56c0.tar.gz"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
|
@ -65,11 +65,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1731952509,
|
"lastModified": 1703863825,
|
||||||
"narHash": "sha256-p4gB3Rhw8R6Ak4eMl8pqjCPOLCZRqaehZxdZ/mbFClM=",
|
"narHash": "sha256-rXwqjtwiGKJheXB43ybM8NwWB8rO2dSRrEqes0S7F5Y=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nix-github-actions",
|
"repo": "nix-github-actions",
|
||||||
"rev": "7b5f051df789b6b20d259924d349a9ba3319b226",
|
"rev": "5163432afc817cf8bd1f031418d1869e4c9d5547",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -81,11 +81,11 @@
|
||||||
"nix2container": {
|
"nix2container": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1724996935,
|
"lastModified": 1712990762,
|
||||||
"narHash": "sha256-njRK9vvZ1JJsP8oV2OgkBrpJhgQezI03S7gzskCcHos=",
|
"narHash": "sha256-hO9W3w7NcnYeX8u8cleHiSpK2YJo7ecarFTUlbybl7k=",
|
||||||
"owner": "nlewo",
|
"owner": "nlewo",
|
||||||
"repo": "nix2container",
|
"repo": "nix2container",
|
||||||
"rev": "fa6bb0a1159f55d071ba99331355955ae30b3401",
|
"rev": "20aad300c925639d5d6cbe30013c8357ce9f2a2e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -96,11 +96,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1733408989,
|
"lastModified": 1718676691,
|
||||||
"narHash": "sha256-VCQpCQy+6ik+oYKWUCvq0WM2V7UtEKldqdsEzCNEOLc=",
|
"narHash": "sha256-DWKbARWtRpT1yiLLm+5vMijx65YB7NwGZMV6NXOtrJ8=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "d916387b68a74040a3873ad2a08a559c60cedb5e",
|
"rev": "d9e18354acbf59c625505b7315c85508e9831bf4",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -129,11 +129,11 @@
|
||||||
"pre-commit-hooks": {
|
"pre-commit-hooks": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1726745158,
|
"lastModified": 1712055707,
|
||||||
"narHash": "sha256-D5AegvGoEjt4rkKedmxlSEmC+nNLMBPWFxvmYnVLhjk=",
|
"narHash": "sha256-4XLvuSIDZJGS17xEwSrNuJLL7UjDYKGJSbK1WWX2AK8=",
|
||||||
"owner": "cachix",
|
"owner": "cachix",
|
||||||
"repo": "git-hooks.nix",
|
"repo": "git-hooks.nix",
|
||||||
"rev": "4e743a6920eab45e8ba0fbe49dc459f1423a4b74",
|
"rev": "e35aed5fda3cc79f88ed7f1795021e559582093a",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -158,11 +158,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1732292307,
|
"lastModified": 1718139168,
|
||||||
"narHash": "sha256-5WSng844vXt8uytT5djmqBCkopyle6ciFgteuA9bJpw=",
|
"narHash": "sha256-1TZQcdETNdJMcfwwoshVeCjwWfrPtkSQ8y8wFX3it7k=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "treefmt-nix",
|
"repo": "treefmt-nix",
|
||||||
"rev": "705df92694af7093dfbb27109ce16d828a79155f",
|
"rev": "1cb529bffa880746a1d0ec4e0f5076876af931f1",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
50
src/drv.cc
50
src/drv.cc
|
@ -23,17 +23,14 @@
|
||||||
#include "drv.hh"
|
#include "drv.hh"
|
||||||
#include "eval-args.hh"
|
#include "eval-args.hh"
|
||||||
|
|
||||||
static bool
|
static bool queryIsCached(nix::Store &store,
|
||||||
queryIsCached(nix::Store &store,
|
std::map<std::string, std::string> &outputs) {
|
||||||
std::map<std::string, std::optional<std::string>> &outputs) {
|
|
||||||
uint64_t downloadSize, narSize;
|
uint64_t downloadSize, narSize;
|
||||||
nix::StorePathSet willBuild, willSubstitute, unknown;
|
nix::StorePathSet willBuild, willSubstitute, unknown;
|
||||||
|
|
||||||
std::vector<nix::StorePathWithOutputs> paths;
|
std::vector<nix::StorePathWithOutputs> paths;
|
||||||
for (auto const &[key, val] : outputs) {
|
for (auto const &[key, val] : outputs) {
|
||||||
if (val) {
|
paths.push_back(followLinksToStorePathWithOutputs(store, val));
|
||||||
paths.push_back(followLinksToStorePathWithOutputs(store, *val));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
store.queryMissing(toDerivedPaths(paths), willBuild, willSubstitute,
|
store.queryMissing(toDerivedPaths(paths), willBuild, willSubstitute,
|
||||||
|
@ -45,37 +42,26 @@ queryIsCached(nix::Store &store,
|
||||||
Drv::Drv(std::string &attrPath, nix::EvalState &state, nix::DrvInfo &drvInfo,
|
Drv::Drv(std::string &attrPath, nix::EvalState &state, nix::DrvInfo &drvInfo,
|
||||||
MyArgs &args) {
|
MyArgs &args) {
|
||||||
|
|
||||||
auto localStore = state.ctx.store.dynamic_pointer_cast<nix::LocalFSStore>();
|
auto localStore = state.store.dynamic_pointer_cast<nix::LocalFSStore>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// CA derivations do not have static output paths, so we have to
|
for (auto out : drvInfo.queryOutputs(true)) {
|
||||||
// defensively not query output paths in case we encounter one.
|
if (out.second)
|
||||||
for (auto &[outputName, optOutputPath] :
|
outputs[out.first] = localStore->printStorePath(*out.second);
|
||||||
drvInfo.queryOutputs(state, !nix::experimentalFeatureSettings.isEnabled(
|
|
||||||
nix::Xp::CaDerivations))) {
|
|
||||||
if (optOutputPath) {
|
|
||||||
outputs[outputName] =
|
|
||||||
localStore->printStorePath(*optOutputPath);
|
|
||||||
} else {
|
|
||||||
assert(nix::experimentalFeatureSettings.isEnabled(
|
|
||||||
nix::Xp::CaDerivations));
|
|
||||||
outputs[outputName] = std::nullopt;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
state.ctx.errors.make<nix::EvalError>(
|
throw nix::EvalError(state,
|
||||||
"derivation '%s' does not have valid outputs: %s",
|
"derivation '%s' does not have valid outputs: %s",
|
||||||
attrPath, e.what()
|
attrPath, e.what());
|
||||||
).debugThrow();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.meta) {
|
if (args.meta) {
|
||||||
nlohmann::json meta_;
|
nlohmann::json meta_;
|
||||||
for (auto &metaName : drvInfo.queryMetaNames(state)) {
|
for (auto &metaName : drvInfo.queryMetaNames()) {
|
||||||
nix::NixStringContext context;
|
nix::NixStringContext context;
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
|
|
||||||
auto metaValue = drvInfo.queryMeta(state, metaName);
|
auto metaValue = drvInfo.queryMeta(metaName);
|
||||||
// Skip non-serialisable types
|
// Skip non-serialisable types
|
||||||
// TODO: Fix serialisation of derivations to store paths
|
// TODO: Fix serialisation of derivations to store paths
|
||||||
if (metaValue == 0) {
|
if (metaValue == 0) {
|
||||||
|
@ -97,9 +83,9 @@ Drv::Drv(std::string &attrPath, nix::EvalState &state, nix::DrvInfo &drvInfo,
|
||||||
cacheStatus = Drv::CacheStatus::Unknown;
|
cacheStatus = Drv::CacheStatus::Unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
drvPath = localStore->printStorePath(drvInfo.requireDrvPath(state));
|
drvPath = localStore->printStorePath(drvInfo.requireDrvPath());
|
||||||
|
|
||||||
auto drv = localStore->readDerivation(drvInfo.requireDrvPath(state));
|
auto drv = localStore->readDerivation(drvInfo.requireDrvPath());
|
||||||
for (const auto &[inputDrvPath, inputNode] : drv.inputDrvs.map) {
|
for (const auto &[inputDrvPath, inputNode] : drv.inputDrvs.map) {
|
||||||
std::set<std::string> inputDrvOutputs;
|
std::set<std::string> inputDrvOutputs;
|
||||||
for (auto &outputName : inputNode.value) {
|
for (auto &outputName : inputNode.value) {
|
||||||
|
@ -107,21 +93,15 @@ Drv::Drv(std::string &attrPath, nix::EvalState &state, nix::DrvInfo &drvInfo,
|
||||||
}
|
}
|
||||||
inputDrvs[localStore->printStorePath(inputDrvPath)] = inputDrvOutputs;
|
inputDrvs[localStore->printStorePath(inputDrvPath)] = inputDrvOutputs;
|
||||||
}
|
}
|
||||||
name = drvInfo.queryName(state);
|
name = drvInfo.queryName();
|
||||||
system = drv.platform;
|
system = drv.platform;
|
||||||
}
|
}
|
||||||
|
|
||||||
void to_json(nlohmann::json &json, const Drv &drv) {
|
void to_json(nlohmann::json &json, const Drv &drv) {
|
||||||
std::map<std::string, nlohmann::json> outputsJson;
|
|
||||||
for (auto &[name, optPath] : drv.outputs) {
|
|
||||||
outputsJson[name] =
|
|
||||||
optPath ? nlohmann::json(*optPath) : nlohmann::json(nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
json = nlohmann::json{{"name", drv.name},
|
json = nlohmann::json{{"name", drv.name},
|
||||||
{"system", drv.system},
|
{"system", drv.system},
|
||||||
{"drvPath", drv.drvPath},
|
{"drvPath", drv.drvPath},
|
||||||
{"outputs", outputsJson},
|
{"outputs", drv.outputs},
|
||||||
{"inputDrvs", drv.inputDrvs}};
|
{"inputDrvs", drv.inputDrvs}};
|
||||||
|
|
||||||
if (drv.meta.has_value()) {
|
if (drv.meta.has_value()) {
|
||||||
|
|
|
@ -24,7 +24,7 @@ struct Drv {
|
||||||
std::string drvPath;
|
std::string drvPath;
|
||||||
|
|
||||||
enum class CacheStatus { Cached, Uncached, Unknown } cacheStatus;
|
enum class CacheStatus { Cached, Uncached, Unknown } cacheStatus;
|
||||||
std::map<std::string, std::optional<std::string>> outputs;
|
std::map<std::string, std::string> outputs;
|
||||||
std::map<std::string, std::set<std::string>> inputDrvs;
|
std::map<std::string, std::set<std::string>> inputDrvs;
|
||||||
std::optional<nlohmann::json> meta;
|
std::optional<nlohmann::json> meta;
|
||||||
|
|
||||||
|
|
|
@ -100,5 +100,5 @@ MyArgs::MyArgs() : MixCommonArgs("nix-eval-jobs") {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyArgs::parseArgs(char **argv, int argc) {
|
void MyArgs::parseArgs(char **argv, int argc) {
|
||||||
parseCmdline(nix::Strings(argv + 1, argv + argc));
|
parseCmdline(nix::argvToStrings(argc, argv));
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <nlohmann/json_fwd.hpp>
|
#include <nlohmann/json_fwd.hpp>
|
||||||
#include <lix/libutil/ref.hh>
|
#include <lix/libutil/ref.hh>
|
||||||
#include <lix/libstore/store-api.hh>
|
#include <lix/libstore/store-api.hh>
|
||||||
|
#include <map>
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
@ -46,8 +47,9 @@ using namespace nlohmann;
|
||||||
|
|
||||||
static MyArgs myArgs;
|
static MyArgs myArgs;
|
||||||
|
|
||||||
using Processor = std::function<void(ref<nix::eval_cache::CachingEvaluator> state, Bindings &autoArgs,
|
typedef std::function<void(ref<EvalState> state, Bindings &autoArgs,
|
||||||
AutoCloseFD &to, AutoCloseFD &from, MyArgs &args)>;
|
AutoCloseFD &to, AutoCloseFD &from, MyArgs &args)>
|
||||||
|
Processor;
|
||||||
|
|
||||||
/* Auto-cleanup of fork's process and fds. */
|
/* Auto-cleanup of fork's process and fds. */
|
||||||
struct Proc {
|
struct Proc {
|
||||||
|
@ -68,10 +70,10 @@ struct Proc {
|
||||||
auto evalStore = myArgs.evalStoreUrl
|
auto evalStore = myArgs.evalStoreUrl
|
||||||
? openStore(*myArgs.evalStoreUrl)
|
? openStore(*myArgs.evalStoreUrl)
|
||||||
: openStore();
|
: openStore();
|
||||||
auto evaluator = nix::make_ref<nix::eval_cache::CachingEvaluator>(myArgs.searchPath,
|
auto state = std::make_shared<EvalState>(myArgs.searchPath,
|
||||||
evalStore);
|
evalStore);
|
||||||
Bindings &autoArgs = *myArgs.getAutoArgs(*evaluator);
|
Bindings &autoArgs = *myArgs.getAutoArgs(*state);
|
||||||
proc(evaluator, autoArgs, *to, *from, myArgs);
|
proc(ref<EvalState>(state), autoArgs, *to, *from, myArgs);
|
||||||
} catch (Error &e) {
|
} catch (Error &e) {
|
||||||
nlohmann::json err;
|
nlohmann::json err;
|
||||||
auto msg = e.msg();
|
auto msg = e.msg();
|
||||||
|
@ -342,16 +344,24 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
return handleExceptions(argv[0], [&]() {
|
return handleExceptions(argv[0], [&]() {
|
||||||
initNix();
|
initNix();
|
||||||
initLibExpr();
|
initGC();
|
||||||
|
|
||||||
myArgs.parseArgs(argv, argc);
|
myArgs.parseArgs(argv, argc);
|
||||||
|
|
||||||
|
/* FIXME: The build hook in conjunction with import-from-derivation is
|
||||||
|
* causing "unexpected EOF" during eval */
|
||||||
|
settings.builders = "";
|
||||||
|
|
||||||
|
/* Prevent access to paths outside of the Nix search path and
|
||||||
|
to the environment. */
|
||||||
|
evalSettings.restrictEval = false;
|
||||||
|
|
||||||
/* When building a flake, use pure evaluation (no access to
|
/* When building a flake, use pure evaluation (no access to
|
||||||
'getEnv', 'currentSystem' etc. */
|
'getEnv', 'currentSystem' etc. */
|
||||||
if (myArgs.impure) {
|
if (myArgs.impure) {
|
||||||
evalSettings.pureEval.override(false);
|
evalSettings.pureEval = false;
|
||||||
} else if (myArgs.flake) {
|
} else if (myArgs.flake) {
|
||||||
evalSettings.pureEval.override(true);
|
evalSettings.pureEval = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myArgs.releaseExpr == "")
|
if (myArgs.releaseExpr == "")
|
||||||
|
@ -364,7 +374,7 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myArgs.showTrace) {
|
if (myArgs.showTrace) {
|
||||||
loggerSettings.showTrace.override(true);
|
loggerSettings.showTrace.assign(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Sync<State> state_;
|
Sync<State> state_;
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
#include <lix/libutil/canon-path.hh>
|
#include <lix/libutil/canon-path.hh>
|
||||||
#include <lix/libcmd/common-eval-args.hh>
|
#include <lix/libcmd/common-eval-args.hh>
|
||||||
#include <lix/libutil/error.hh>
|
#include <lix/libutil/error.hh>
|
||||||
#include <lix/libexpr/eval-cache.hh>
|
|
||||||
#include <lix/libexpr/eval-inline.hh>
|
#include <lix/libexpr/eval-inline.hh>
|
||||||
#include <lix/libexpr/eval.hh>
|
#include <lix/libexpr/eval.hh>
|
||||||
#include <lix/libexpr/flake/flakeref.hh>
|
#include <lix/libexpr/flake/flakeref.hh>
|
||||||
|
@ -49,14 +48,14 @@ static nix::Value *releaseExprTopLevelValue(nix::EvalState &state,
|
||||||
nix::Value vTop;
|
nix::Value vTop;
|
||||||
|
|
||||||
if (args.fromArgs) {
|
if (args.fromArgs) {
|
||||||
nix::Expr &e = state.ctx.parseExprFromString(
|
nix::Expr &e = state.parseExprFromString(
|
||||||
args.releaseExpr, nix::CanonPath::fromCwd());
|
args.releaseExpr, state.rootPath(nix::CanonPath::fromCwd()));
|
||||||
state.eval(e, vTop);
|
state.eval(e, vTop);
|
||||||
} else {
|
} else {
|
||||||
state.evalFile(nix::lookupFileArg(state.ctx, args.releaseExpr), vTop);
|
state.evalFile(lookupFileArg(state, args.releaseExpr), vTop);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto vRoot = state.ctx.mem.allocValue();
|
auto vRoot = state.allocValue();
|
||||||
|
|
||||||
state.autoCallFunction(autoArgs, vTop, *vRoot);
|
state.autoCallFunction(autoArgs, vTop, *vRoot);
|
||||||
|
|
||||||
|
@ -74,17 +73,16 @@ static std::string attrPathJoin(nlohmann::json input) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void worker(nix::ref<nix::eval_cache::CachingEvaluator> evaluator, nix::Bindings &autoArgs,
|
void worker(nix::ref<nix::EvalState> state, nix::Bindings &autoArgs,
|
||||||
nix::AutoCloseFD &to, nix::AutoCloseFD &from, MyArgs &args) {
|
nix::AutoCloseFD &to, nix::AutoCloseFD &from, MyArgs &args) {
|
||||||
|
|
||||||
nix::Value *vRoot = [&]() {
|
nix::Value *vRoot = [&]() {
|
||||||
auto state = evaluator->begin();
|
|
||||||
if (args.flake) {
|
if (args.flake) {
|
||||||
auto [flakeRef, fragment, outputSpec] =
|
auto [flakeRef, fragment, outputSpec] =
|
||||||
nix::parseFlakeRefWithFragmentAndExtendedOutputsSpec(
|
nix::parseFlakeRefWithFragmentAndExtendedOutputsSpec(
|
||||||
args.releaseExpr, nix::absPath("."));
|
args.releaseExpr, nix::absPath("."));
|
||||||
nix::InstallableFlake flake{
|
nix::InstallableFlake flake{
|
||||||
{}, evaluator, std::move(flakeRef), fragment, outputSpec,
|
{}, state, std::move(flakeRef), fragment, outputSpec,
|
||||||
{}, {}, args.lockFlags};
|
{}, {}, args.lockFlags};
|
||||||
|
|
||||||
return flake.toValue(*state).first;
|
return flake.toValue(*state).first;
|
||||||
|
@ -94,7 +92,6 @@ void worker(nix::ref<nix::eval_cache::CachingEvaluator> evaluator, nix::Bindings
|
||||||
}();
|
}();
|
||||||
|
|
||||||
LineReader fromReader(from.release());
|
LineReader fromReader(from.release());
|
||||||
auto state = evaluator->begin();
|
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
/* Wait for the collector to send us a job name. */
|
/* Wait for the collector to send us a job name. */
|
||||||
|
@ -122,7 +119,7 @@ void worker(nix::ref<nix::eval_cache::CachingEvaluator> evaluator, nix::Bindings
|
||||||
nix::findAlongAttrPath(*state, attrPathS, autoArgs, *vRoot)
|
nix::findAlongAttrPath(*state, attrPathS, autoArgs, *vRoot)
|
||||||
.first;
|
.first;
|
||||||
|
|
||||||
auto v = evaluator->mem.allocValue();
|
auto v = state->allocValue();
|
||||||
state->autoCallFunction(autoArgs, *vTmp, *v);
|
state->autoCallFunction(autoArgs, *vTmp, *v);
|
||||||
|
|
||||||
if (v->type() == nix::nAttrs) {
|
if (v->type() == nix::nAttrs) {
|
||||||
|
@ -139,7 +136,7 @@ void worker(nix::ref<nix::eval_cache::CachingEvaluator> evaluator, nix::Bindings
|
||||||
std::string(nix::baseNameOf(drv.drvPath));
|
std::string(nix::baseNameOf(drv.drvPath));
|
||||||
if (!nix::pathExists(root)) {
|
if (!nix::pathExists(root)) {
|
||||||
auto localStore =
|
auto localStore =
|
||||||
evaluator->store
|
state->store
|
||||||
.dynamic_pointer_cast<nix::LocalFSStore>();
|
.dynamic_pointer_cast<nix::LocalFSStore>();
|
||||||
auto storePath =
|
auto storePath =
|
||||||
localStore->parseStorePath(drv.drvPath);
|
localStore->parseStorePath(drv.drvPath);
|
||||||
|
@ -154,14 +151,14 @@ void worker(nix::ref<nix::eval_cache::CachingEvaluator> evaluator, nix::Bindings
|
||||||
// = true;` for top-level attrset
|
// = true;` for top-level attrset
|
||||||
|
|
||||||
for (auto &i :
|
for (auto &i :
|
||||||
v->attrs->lexicographicOrder(evaluator->symbols)) {
|
v->attrs->lexicographicOrder(state->symbols)) {
|
||||||
const std::string &name = evaluator->symbols[i->name];
|
const std::string &name = state->symbols[i->name];
|
||||||
attrs.push_back(name);
|
attrs.push_back(name);
|
||||||
|
|
||||||
if (name == "recurseForDerivations" &&
|
if (name == "recurseForDerivations" &&
|
||||||
!args.forceRecurse) {
|
!args.forceRecurse) {
|
||||||
auto attrv =
|
auto attrv =
|
||||||
v->attrs->get(evaluator->s.recurseForDerivations);
|
v->attrs->get(state->sRecurseForDerivations);
|
||||||
recurse = state->forceBool(
|
recurse = state->forceBool(
|
||||||
*attrv->value, attrv->pos,
|
*attrv->value, attrv->pos,
|
||||||
"while evaluating recurseForDerivations");
|
"while evaluating recurseForDerivations");
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <lix/libmain/shared.hh>
|
#include <lix/libmain/shared.hh>
|
||||||
#include <lix/libexpr/eval.hh>
|
#include <lix/libexpr/eval.hh>
|
||||||
#include <lix/libexpr/eval-cache.hh>
|
|
||||||
|
|
||||||
#include "eval-args.hh"
|
#include "eval-args.hh"
|
||||||
|
|
||||||
|
@ -14,5 +13,5 @@ class EvalState;
|
||||||
template <typename T> class ref;
|
template <typename T> class ref;
|
||||||
} // namespace nix
|
} // namespace nix
|
||||||
|
|
||||||
void worker(nix::ref<nix::eval_cache::CachingEvaluator> evaluator, nix::Bindings &autoArgs,
|
void worker(nix::ref<nix::EvalState> state, nix::Bindings &autoArgs,
|
||||||
nix::AutoCloseFD &to, nix::AutoCloseFD &from, MyArgs &args);
|
nix::AutoCloseFD &to, nix::AutoCloseFD &from, MyArgs &args);
|
||||||
|
|
Loading…
Reference in a new issue