aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/build
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2021-05-09 17:46:16 +0200
committerMaximilian Bosch <maximilian@mbosch.me>2021-06-22 19:15:57 +0200
commit3944a120ec6986c723bf36bfade9b331dd4af68a (patch)
tree5378c3c52e99be53bcc98a7a8e30080ee6d53f6f /src/libstore/build
parent3b5429aec110a22f8fe0d92b72faf1921b8ede2d (diff)
Set environment variables for .attrs.json & .attrs.sh
This way no derivation has to expect that these files are in the `cwd` during the build. This is problematic for `nix-shell` where these files would have to be inserted into the nix-shell's `cwd` which can become problematic with e.g. recursive `nix-shell`. To remain backwards-compatible, the location inside the build sandbox will be kept, however using these files directly should be deprecated from now on.
Diffstat (limited to 'src/libstore/build')
-rw-r--r--src/libstore/build/local-derivation-goal.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libstore/build/local-derivation-goal.cc b/src/libstore/build/local-derivation-goal.cc
index 9bb6f276c..e6b552b94 100644
--- a/src/libstore/build/local-derivation-goal.cc
+++ b/src/libstore/build/local-derivation-goal.cc
@@ -1093,8 +1093,10 @@ void LocalDerivationGoal::writeStructuredAttrs()
writeFile(tmpDir + "/.attrs.sh", rewriteStrings(jsonSh, inputRewrites));
chownToBuilder(tmpDir + "/.attrs.sh");
+ env["ATTRS_SH_FILE"] = tmpDir + "/.attrs.sh";
writeFile(tmpDir + "/.attrs.json", rewriteStrings(json.dump(), inputRewrites));
chownToBuilder(tmpDir + "/.attrs.json");
+ env["ATTRS_JSON_FILE"] = tmpDir + "/.attrs.json";
}
}