1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-26 20:01:15 +02:00

Add --eval-store option

This commit is contained in:
Eelco Dolstra 2021-06-29 21:09:48 +02:00
parent dfda499326
commit bef40c2949
5 changed files with 57 additions and 18 deletions

View file

@ -54,6 +54,38 @@ void StoreCommand::run()
run(getStore());
}
EvalCommand::EvalCommand()
{
// FIXME: move to MixEvalArgs?
addFlag({
.longName = "eval-store",
.description = "The Nix store to use for evaluations.",
.labels = {"store-url"},
//.category = ...,
.handler = {&evalStoreUrl},
});
}
EvalCommand::~EvalCommand()
{
if (evalState)
evalState->printStats();
}
ref<Store> EvalCommand::getEvalStore()
{
if (!evalStore)
evalStore = evalStoreUrl ? openStore(*evalStoreUrl) : getStore();
return ref<Store>(evalStore);
}
ref<EvalState> EvalCommand::getEvalState()
{
if (!evalState)
evalState = std::make_shared<EvalState>(searchPath, getEvalStore(), getStore());
return ref<EvalState>(evalState);
}
BuiltPathsCommand::BuiltPathsCommand(bool recursive)
: recursive(recursive)
{