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.
This commit is contained in:
adisbladis 2022-10-18 13:56:45 +13:00
parent 9b0ef420d3
commit b9836f2e06

View file

@ -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