about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--doc/manual/expressions/advanced-attributes.xml16
-rw-r--r--src/libstore/build.cc2
-rw-r--r--tests/pass-as-file.sh2
3 files changed, 13 insertions, 7 deletions
diff --git a/doc/manual/expressions/advanced-attributes.xml b/doc/manual/expressions/advanced-attributes.xml
index fee35f0bef48..83ad6eefc8b1 100644
--- a/doc/manual/expressions/advanced-attributes.xml
+++ b/doc/manual/expressions/advanced-attributes.xml
@@ -254,11 +254,17 @@ big = "a very long string";
     </programlisting>
 
     then when the builder runs, the environment variable
-    <envar>big</envar> will contain the absolute path to a temporary
-    file containing <literal>a very long string</literal>. This is
-    useful when you need to pass large strings to a builder, since
-    most operating systems impose a limit on the size of the
-    environment (typically, a few hundred kilobyte).</para></listitem>
+    <envar>bigPath</envar> will contain the absolute path to a
+    temporary file containing <literal>a very long
+    string</literal>. That is, for any attribute
+    <replaceable>x</replaceable> listed in
+    <varname>passAsFile</varname>, Nix will pass an environment
+    variable <envar><replaceable>x</replaceable>Path</envar> holding
+    the path of the file containing the value of attribute
+    <replaceable>x</replaceable>. This is useful when you need to pass
+    large strings to a builder, since most operating systems impose a
+    limit on the size of the environment (typically, a few hundred
+    kilobyte).</para></listitem>
 
   </varlistentry>
 
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 0b1985828b52..e64bd3fef587 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -1662,7 +1662,7 @@ void DerivationGoal::startBuilder()
         } else {
             Path p = tmpDir + "/.attr-" + int2String(fileNr++);
             writeFile(p, i.second);
-            env[i.first] = p;
+            env[i.first + "Path"] = p;
         }
     }
 
diff --git a/tests/pass-as-file.sh b/tests/pass-as-file.sh
index b61576e05799..3dfe10baa235 100644
--- a/tests/pass-as-file.sh
+++ b/tests/pass-as-file.sh
@@ -10,7 +10,7 @@ mkDerivation {
   passAsFile = [ \"foo\" ];
   foo = [ \"xyzzy\" ];
   builder = builtins.toFile \"builder.sh\" ''
-    [ \"\$(cat \$foo)\" = xyzzy ]
+    [ \"\$(cat \$fooPath)\" = xyzzy ]
     touch \$out
   '';
 }