From 7a5b85cdda7d619ec81de124e601e2333084dce4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Sun, 29 May 2016 14:25:09 +0100 Subject: [PATCH] pkgs.runCommand: passAsFile (buildCommand can be very long) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- pkgs/build-support/trivial-builders.nix | 1 + pkgs/stdenv/generic/setup.sh | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/pkgs/build-support/trivial-builders.nix b/pkgs/build-support/trivial-builders.nix index 73f4d7783c4..18e49105ae7 100644 --- a/pkgs/build-support/trivial-builders.nix +++ b/pkgs/build-support/trivial-builders.nix @@ -8,6 +8,7 @@ rec { runCommand = name: env: buildCommand: stdenv.mkDerivation ({ inherit name buildCommand; + passAsFile = [ "buildCommand" ]; } // env); diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 85e74461d2a..5b50167d9b9 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -827,6 +827,10 @@ showPhaseHeader() { genericBuild() { + if [ -f "$buildCommandPath" ]; then + . "$buildCommandPath" + return + fi if [ -n "$buildCommand" ]; then eval "$buildCommand" return