Add full meta to output

While the current output may be sufficient for Hydra it's not enough
for a more generically useful evaluator.
This commit is contained in:
adisbladis 2021-08-23 18:29:04 -05:00
parent b92dfbba57
commit 19823c899d
No known key found for this signature in database
GPG key ID: 110BFAD44C6249B7

View file

@ -17,6 +17,8 @@
#include <nix/derivations.hh> #include <nix/derivations.hh>
#include <nix/local-fs-store.hh> #include <nix/local-fs-store.hh>
#include <nix/value-to-json.hh>
#include <sys/types.h> #include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <sys/resource.h> #include <sys/resource.h>
@ -217,6 +219,16 @@ static void worker(
job["maxSilent"] = drv->queryMetaInt("maxSilent", 7200); job["maxSilent"] = drv->queryMetaInt("maxSilent", 7200);
job["isChannel"] = drv->queryMetaBool("isHydraChannel", false); job["isChannel"] = drv->queryMetaBool("isHydraChannel", false);
nlohmann::json meta;
for (auto & name : drv->queryMetaNames()) {
PathSet context;
std::stringstream ss;
printValueAsJSON(state, true, *drv->queryMeta(name), ss, context);
nlohmann::json field = nlohmann::json::parse(ss.str());
meta[name] = field;
}
job["meta"] = meta;
/* If this is an aggregate, then get its constituents. */ /* If this is an aggregate, then get its constituents. */
auto a = v->attrs->get(state.symbols.create("_hydraAggregate")); auto a = v->attrs->get(state.symbols.create("_hydraAggregate"));
if (a && state.forceBool(*a->value, *a->pos)) { if (a && state.forceBool(*a->value, *a->pos)) {