From 617d4ee15138840c468d7ac4fefe21bef740d8bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Sun, 21 Mar 2021 18:39:32 +0100 Subject: [PATCH] add --impure flag for flakes --- src/hydra-eval-jobs.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/hydra-eval-jobs.cc b/src/hydra-eval-jobs.cc index 2f96473..5a09790 100644 --- a/src/hydra-eval-jobs.cc +++ b/src/hydra-eval-jobs.cc @@ -25,6 +25,7 @@ using namespace nix; +typedef enum { evalAuto, evalImpure, evalPure } pureEval; struct MyArgs : MixEvalArgs, MixCommonArgs { @@ -34,6 +35,7 @@ struct MyArgs : MixEvalArgs, MixCommonArgs bool dryRun = false; size_t nrWorkers = 1; size_t maxMemorySize = 4096; + pureEval evalMode = evalAuto; MyArgs() : MixCommonArgs("hydra-eval-jobs") { @@ -52,6 +54,13 @@ struct MyArgs : MixEvalArgs, MixCommonArgs }}, }); + addFlag({ + .longName = "impure", + .description = "set evaluation mode", + .handler = {[&]() { + evalMode = evalImpure; + }}, + }); addFlag({ .longName = "gc-roots-dir", .description = "garbage collector roots directory", @@ -311,7 +320,7 @@ int main(int argc, char * * argv) /* When building a flake, use pure evaluation (no access to 'getEnv', 'currentSystem' etc. */ - evalSettings.pureEval = myArgs.flake; + evalSettings.pureEval = myArgs.evalMode == evalAuto ? myArgs.flake : myArgs.evalMode == evalPure; if (myArgs.dryRun) settings.readOnlyMode = true;