pkgs.runCommand: passAsFile (buildCommand can be very long)

Close #15803. This avoids the error:

while setting up the build environment: executing
‘/nix/store/7sb42axk5lrxqz45nldrb2pchlys14s1-bash-4.3-p42/bin/bash’:
Argument list too long

Note: I wanted to make it optional based on buildCommand length,
but that seems pointless as I'm sure it's less performant.

Amended by vcunat:
https://github.com/NixOS/nixpkgs/pull/15803#issuecomment-224841225
This commit is contained in:
Domen Kožar 2016-05-29 14:25:09 +01:00 committed by Vladimír Čunát
parent 46f22d89b9
commit 7a5b85cdda
2 changed files with 5 additions and 0 deletions

View file

@ -8,6 +8,7 @@ rec {
runCommand = name: env: buildCommand:
stdenv.mkDerivation ({
inherit name buildCommand;
passAsFile = [ "buildCommand" ];
} // env);

View file

@ -827,6 +827,10 @@ showPhaseHeader() {
genericBuild() {
if [ -f "$buildCommandPath" ]; then
. "$buildCommandPath"
return
fi
if [ -n "$buildCommand" ]; then
eval "$buildCommand"
return