aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/parsed-derivations.cc
diff options
context:
space:
mode:
authorBen Burdette <bburdette@gmail.com>2020-04-06 10:00:00 -0600
committerBen Burdette <bburdette@gmail.com>2020-04-06 10:00:00 -0600
commit216263c36f7827a1cf578627579f9cb074dc2749 (patch)
treef9cd590c619319be2b3116f03f1f369051797fcc /src/libstore/parsed-derivations.cc
parent1221ae3dd07959d47d9f27e9d2271671003d2bed (diff)
parentebb20a5356af023498506324bd0f88a99175e295 (diff)
Merge branch 'master' into error-format
Diffstat (limited to 'src/libstore/parsed-derivations.cc')
-rw-r--r--src/libstore/parsed-derivations.cc6
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) {