1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-11 04:56:01 +01:00

nix-instantiate --eval --json: Devirtualize the output

This commit is contained in:
Eelco Dolstra 2025-06-11 17:14:33 +02:00
parent 7bafc99f20
commit df7a2a1bed

View file

@ -17,6 +17,7 @@
#include <map> #include <map>
#include <iostream> #include <iostream>
#include <nlohmann/json.hpp>
using namespace nix; using namespace nix;
@ -61,8 +62,8 @@ void processExpr(EvalState & state, const Strings & attrPaths,
else if (output == okXML) else if (output == okXML)
printValueAsXML(state, strict, location, vRes, std::cout, context, noPos); printValueAsXML(state, strict, location, vRes, std::cout, context, noPos);
else if (output == okJSON) { else if (output == okJSON) {
printValueAsJSON(state, strict, vRes, v.determinePos(noPos), std::cout, context); auto j = printValueAsJSON(state, strict, vRes, v.determinePos(noPos), context);
std::cout << std::endl; std::cout << state.devirtualize(j.dump(), context) << std::endl;
} else { } else {
if (strict) state.forceValueDeep(vRes); if (strict) state.forceValueDeep(vRes);
std::set<const void *> seen; std::set<const void *> seen;