diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-03-24 14:26:13 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-03-24 14:34:47 +0100 |
commit | 0a10854f857e519d1455ff0f0be1f8401c40a11c (patch) | |
tree | 64cd9b1c0727eb0642574e4535c5ba61af497c3a /src/libstore/parsed-derivations.cc | |
parent | c85097da7c1ef06e2f1912c922110ff358de3aa2 (diff) |
Misc changes from the flakes branch
Diffstat (limited to 'src/libstore/parsed-derivations.cc')
-rw-r--r-- | src/libstore/parsed-derivations.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libstore/parsed-derivations.cc b/src/libstore/parsed-derivations.cc index d0f289a0f..45c033c66 100644 --- a/src/libstore/parsed-derivations.cc +++ b/src/libstore/parsed-derivations.cc @@ -1,5 +1,7 @@ #include "parsed-derivations.hh" +#include <nlohmann/json.hpp> + namespace nix { ParsedDerivation::ParsedDerivation(StorePath && drvPath, BasicDerivation & drv) @@ -9,13 +11,15 @@ ParsedDerivation::ParsedDerivation(StorePath && drvPath, BasicDerivation & drv) auto jsonAttr = drv.env.find("__json"); if (jsonAttr != drv.env.end()) { try { - structuredAttrs = nlohmann::json::parse(jsonAttr->second); + structuredAttrs = std::make_unique<nlohmann::json>(nlohmann::json::parse(jsonAttr->second)); } catch (std::exception & e) { throw Error("cannot process __json attribute of '%s': %s", drvPath.to_string(), e.what()); } } } +ParsedDerivation::~ParsedDerivation() { } + std::optional<std::string> ParsedDerivation::getStringAttr(const std::string & name) const { if (structuredAttrs) { |