#include "buildable.hh" #include "store-api.hh" #include namespace nix { nlohmann::json BuildableOpaque::toJSON(ref store) const { nlohmann::json res; res["path"] = store->printStorePath(path); return res; } nlohmann::json BuildableFromDrv::toJSON(ref store) const { nlohmann::json res; res["drvPath"] = store->printStorePath(drvPath); for (const auto& [output, path] : outputs) { res["outputs"][output] = path ? store->printStorePath(*path) : ""; } return res; } nlohmann::json buildablesToJSON(const Buildables & buildables, ref store) { auto res = nlohmann::json::array(); for (const Buildable & buildable : buildables) { std::visit([&res, store](const auto & buildable) { res.push_back(buildable.toJSON(store)); }, buildable); } return res; } }