From bd9106415099b32a51f66be886d18271e65ac9dd Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 17 Feb 2015 16:42:54 +0100 Subject: [PATCH] Use $Path instead of $ for passAsFile --- doc/manual/expressions/advanced-attributes.xml | 16 +++++++++++----- src/libstore/build.cc | 2 +- tests/pass-as-file.sh | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/doc/manual/expressions/advanced-attributes.xml b/doc/manual/expressions/advanced-attributes.xml index fee35f0be..83ad6eefc 100644 --- a/doc/manual/expressions/advanced-attributes.xml +++ b/doc/manual/expressions/advanced-attributes.xml @@ -254,11 +254,17 @@ big = "a very long string"; then when the builder runs, the environment variable - big will contain the absolute path to a temporary - file containing a very long string. 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). + bigPath will contain the absolute path to a + temporary file containing a very long + string. That is, for any attribute + x listed in + passAsFile, Nix will pass an environment + variable xPath holding + the path of the file containing the value of attribute + x. 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). diff --git a/src/libstore/build.cc b/src/libstore/build.cc index 0b1985828..e64bd3fef 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 b61576e05..3dfe10baa 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 ''; }