Merge "libcmd: munge evalSettings in the right place" into main
This commit is contained in:
commit
2a9e560570
|
@ -77,7 +77,7 @@ struct EvalCommand : virtual StoreCommand, MixEvalArgs
|
|||
|
||||
ref<Store> getEvalStore();
|
||||
|
||||
ref<eval_cache::CachingEvaluator> getEvaluator();
|
||||
virtual ref<eval_cache::CachingEvaluator> getEvaluator();
|
||||
|
||||
private:
|
||||
std::shared_ptr<Store> evalStore;
|
||||
|
@ -114,6 +114,8 @@ struct SourceExprCommand : virtual Args, MixFlakeOptions
|
|||
|
||||
SourceExprCommand();
|
||||
|
||||
ref<eval_cache::CachingEvaluator> getEvaluator() override;
|
||||
|
||||
Installables parseInstallables(
|
||||
EvalState & state, ref<Store> store, std::vector<std::string> ss);
|
||||
|
||||
|
|
|
@ -212,9 +212,7 @@ void SourceExprCommand::completeInstallable(EvalState & state, AddCompletions &
|
|||
if (file) {
|
||||
completions.setType(AddCompletions::Type::Attrs);
|
||||
|
||||
evalSettings.pureEval.override(false);
|
||||
auto evaluator = getEvaluator();
|
||||
evaluator->paths.allowedPaths.reset();
|
||||
|
||||
Expr & e = evaluator->parseExprFromFile(
|
||||
resolveExprPath(evaluator->paths.checkSourcePath(lookupFileArg(*evaluator, *file)))
|
||||
|
@ -427,6 +425,16 @@ ref<eval_cache::EvalCache> openEvalCache(
|
|||
}
|
||||
}
|
||||
|
||||
ref<eval_cache::CachingEvaluator> SourceExprCommand::getEvaluator()
|
||||
{
|
||||
// FIXME: backward compatibility hack
|
||||
if (file) {
|
||||
evalSettings.pureEval.override(false);
|
||||
}
|
||||
|
||||
return EvalCommand::getEvaluator();
|
||||
}
|
||||
|
||||
Installables SourceExprCommand::parseInstallables(
|
||||
EvalState & state, ref<Store> store, std::vector<std::string> ss)
|
||||
{
|
||||
|
@ -436,12 +444,6 @@ Installables SourceExprCommand::parseInstallables(
|
|||
if (file && expr)
|
||||
throw UsageError("'--file' and '--expr' are exclusive");
|
||||
|
||||
// FIXME: backward compatibility hack
|
||||
if (file) {
|
||||
evalSettings.pureEval.override(false);
|
||||
getEvaluator()->paths.allowedPaths.reset();
|
||||
}
|
||||
|
||||
auto evaluator = getEvaluator();
|
||||
auto vFile = evaluator->mem.allocValue();
|
||||
|
||||
|
|
|
@ -33,3 +33,6 @@ simpleTest 'builtins.currentSystem' 'bar' --eval-system 'bar'
|
|||
## `eval-system` overrides `system`
|
||||
simpleTest 'builtins.currentSystem' 'bar' --system 'foo' --eval-system 'bar'
|
||||
simpleTest 'builtins.currentSystem' 'baz' --system 'foo' --eval-system 'baz'
|
||||
|
||||
## `-f` honors nix-path
|
||||
[ "$(nix eval --option nix-path "foo=$PWD" -f '<foo/eval.nix>' attr.foo)" = '"bar"' ]
|
||||
|
|
Loading…
Reference in a new issue