aboutsummaryrefslogtreecommitdiff
path: root/src/nix-build/nix-build.cc
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2021-05-13 16:11:56 +0200
committerMaximilian Bosch <maximilian@mbosch.me>2021-06-22 19:15:57 +0200
commitf1e281c4fe1263a0c848bc8aaf57a0e61a99fa93 (patch)
tree0441e2eb826aad0530f7c6522a355ad332b9581f /src/nix-build/nix-build.cc
parent447928bdb55d160617387e7ac5954f9a8f36004b (diff)
Split shell & json creation for build environments with structured attrs
Diffstat (limited to 'src/nix-build/nix-build.cc')
-rwxr-xr-xsrc/nix-build/nix-build.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/nix-build/nix-build.cc b/src/nix-build/nix-build.cc
index 9bd7869f9..4e4f27458 100755
--- a/src/nix-build/nix-build.cc
+++ b/src/nix-build/nix-build.cc
@@ -444,13 +444,16 @@ static void main_nix_build(int argc, char * * argv)
drv
);
- if (auto structAttrs = parsedDrv.generateStructuredAttrs(std::nullopt, *store, inputs)) {
- auto val = structAttrs.value();
- structuredAttrsRC = val.first;
+ if (auto structAttrs = parsedDrv.prepareStructuredAttrs(std::nullopt, *store, inputs)) {
+ auto json = structAttrs.value();
+ structuredAttrsRC = parsedDrv.writeStructuredAttrsShell(json);
+
auto attrsJSON = (Path) tmpDir + "/.attrs.json";
- writeFile(attrsJSON, val.second.dump());
+ writeFile(attrsJSON, json.dump());
+
auto attrsSH = (Path) tmpDir + "/.attrs.sh";
- writeFile(attrsSH, val.first);
+ writeFile(attrsSH, structuredAttrsRC);
+
env["ATTRS_SH_FILE"] = attrsSH;
env["ATTRS_JSON_FILE"] = attrsJSON;
keepTmp = true;