forked from lix-project/nix-eval-jobs
Don't override evalSettings.pureEval unless necessary
Other eval flags like `--pure-eval` may activate `evalSettings.pureEval`, so let's avoid touching it if we don't have to.
This commit is contained in:
parent
77dd514304
commit
9f64612215
|
@ -30,8 +30,6 @@
|
||||||
using namespace nix;
|
using namespace nix;
|
||||||
using namespace nlohmann;
|
using namespace nlohmann;
|
||||||
|
|
||||||
typedef enum { evalAuto, evalImpure, evalPure } pureEval;
|
|
||||||
|
|
||||||
// Safe to ignore - the args will be static.
|
// Safe to ignore - the args will be static.
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
|
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
|
||||||
|
@ -44,9 +42,9 @@ struct MyArgs : MixEvalArgs, MixCommonArgs {
|
||||||
bool flake = false;
|
bool flake = false;
|
||||||
bool meta = false;
|
bool meta = false;
|
||||||
bool showTrace = false;
|
bool showTrace = false;
|
||||||
|
bool impure = false;
|
||||||
size_t nrWorkers = 1;
|
size_t nrWorkers = 1;
|
||||||
size_t maxMemorySize = 4096;
|
size_t maxMemorySize = 4096;
|
||||||
pureEval evalMode = evalAuto;
|
|
||||||
|
|
||||||
MyArgs() : MixCommonArgs("nix-eval-jobs") {
|
MyArgs() : MixCommonArgs("nix-eval-jobs") {
|
||||||
addFlag({
|
addFlag({
|
||||||
|
@ -65,11 +63,9 @@ struct MyArgs : MixEvalArgs, MixCommonArgs {
|
||||||
}},
|
}},
|
||||||
});
|
});
|
||||||
|
|
||||||
addFlag({
|
addFlag({.longName = "impure",
|
||||||
.longName = "impure",
|
.description = "allow impure expressions",
|
||||||
.description = "set evaluation mode",
|
.handler = {&impure, true}});
|
||||||
.handler = {[&]() { evalMode = evalImpure; }},
|
|
||||||
});
|
|
||||||
|
|
||||||
addFlag({.longName = "gc-roots-dir",
|
addFlag({.longName = "gc-roots-dir",
|
||||||
.description = "garbage collector roots directory",
|
.description = "garbage collector roots directory",
|
||||||
|
@ -493,9 +489,11 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
/* 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. */
|
||||||
evalSettings.pureEval = myArgs.evalMode == evalAuto
|
if (myArgs.impure) {
|
||||||
? myArgs.flake
|
evalSettings.pureEval = false;
|
||||||
: myArgs.evalMode == evalPure;
|
} else if (myArgs.flake) {
|
||||||
|
evalSettings.pureEval = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (myArgs.releaseExpr == "")
|
if (myArgs.releaseExpr == "")
|
||||||
throw UsageError("no expression specified");
|
throw UsageError("no expression specified");
|
||||||
|
|
Loading…
Reference in a new issue