1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-30 22:20:59 +01:00

speedup derivation parsing

This commit is contained in:
Philipp Otterbein 2025-08-05 21:59:59 +02:00
parent fd6e383a63
commit 5e94fe5693
3 changed files with 124 additions and 99 deletions

View file

@ -8,16 +8,14 @@
namespace nix {
static constexpr std::string_view envVarName = "__json";
StructuredAttrs StructuredAttrs::parse(const std::string & encoded)
StructuredAttrs StructuredAttrs::parse(std::string_view encoded)
{
try {
return StructuredAttrs{
.structuredAttrs = nlohmann::json::parse(encoded),
};
} catch (std::exception & e) {
throw Error("cannot process __json attribute: %s", e.what());
throw Error("cannot process %s attribute: %s", envVarName, e.what());
}
}