about summary refs log tree commit diff
path: root/third_party/nix/src/libstore
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/nix/src/libstore')
-rw-r--r--third_party/nix/src/libstore/build.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/third_party/nix/src/libstore/build.cc b/third_party/nix/src/libstore/build.cc
index 0b4bce182031..e7a9ea45e6eb 100644
--- a/third_party/nix/src/libstore/build.cc
+++ b/third_party/nix/src/libstore/build.cc
@@ -2485,12 +2485,12 @@ void DerivationGoal::initTmpDir() {
   if (!parsedDrv->getStructuredAttrs()) {
     std::set<std::string> passAsFile =
         absl::StrSplit(get(drv->env, "passAsFile"), absl::ByAnyChar(" \t\n\r"));
-    int fileNr = 0;
     for (auto& i : drv->env) {
       if (passAsFile.find(i.first) == passAsFile.end()) {
         env[i.first] = i.second;
       } else {
-        std::string fn = ".attr-" + std::to_string(fileNr++);
+        auto hash = hashString(htSHA256, i.first);
+        std::string fn = ".attr-" + hash.to_string();
         Path p = tmpDir + "/" + fn;
         writeFile(p, rewriteStrings(i.second, inputRewrites));
         chownToBuilder(p);