From b9836f2e0693e403109ff7bb1ba70a723c555834 Mon Sep 17 00:00:00 2001 From: adisbladis Date: Tue, 18 Oct 2022 13:56:45 +1300 Subject: [PATCH] Add parameter to force recursion (don't honour recurseIntoAttrs) This can be useful when you are not in control over your expressions. My use case is evaluating a Hydra jobset. --- src/nix-eval-jobs.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/nix-eval-jobs.cc b/src/nix-eval-jobs.cc index e20ed5c..b4322f5 100644 --- a/src/nix-eval-jobs.cc +++ b/src/nix-eval-jobs.cc @@ -45,6 +45,7 @@ struct MyArgs : MixEvalArgs, MixCommonArgs { bool meta = false; bool showTrace = false; bool impure = false; + bool forceRecurse = false; bool checkCacheStatus = false; size_t nrWorkers = 1; size_t maxMemorySize = 4096; @@ -70,6 +71,11 @@ struct MyArgs : MixEvalArgs, MixCommonArgs { .description = "allow impure expressions", .handler = {&impure, true}}); + addFlag( + {.longName = "force-recurse", + .description = "force recursion (don't respect recurseIntoAttrs)", + .handler = {&forceRecurse, true}}); + addFlag({.longName = "gc-roots-dir", .description = "garbage collector roots directory", .labels = {"path"}, @@ -321,6 +327,7 @@ static void worker(EvalState &state, Bindings &autoArgs, AutoCloseFD &to, } else { auto attrs = nlohmann::json::array(); bool recurse = + myArgs.forceRecurse || path.size() == 0; // Dont require `recurseForDerivations // = true;` for top-level attrset