about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDomen Kožar <domen@dev.si>2016-05-29 14:25:09 +0100
committerVladimír Čunát <vcunat@gmail.com>2016-06-10 10:49:26 +0200
commit7a5b85cdda7d619ec81de124e601e2333084dce4 (patch)
tree7c822a1f77d52d1196df24e1a614f9835a347256
parent46f22d89b94f6072153687dd50db1bee7c7bd34c (diff)
downloadnixlib-7a5b85cdda7d619ec81de124e601e2333084dce4.tar
nixlib-7a5b85cdda7d619ec81de124e601e2333084dce4.tar.gz
nixlib-7a5b85cdda7d619ec81de124e601e2333084dce4.tar.bz2
nixlib-7a5b85cdda7d619ec81de124e601e2333084dce4.tar.lz
nixlib-7a5b85cdda7d619ec81de124e601e2333084dce4.tar.xz
nixlib-7a5b85cdda7d619ec81de124e601e2333084dce4.tar.zst
nixlib-7a5b85cdda7d619ec81de124e601e2333084dce4.zip
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
-rw-r--r--pkgs/build-support/trivial-builders.nix1
-rw-r--r--pkgs/stdenv/generic/setup.sh4
2 files changed, 5 insertions, 0 deletions
diff --git a/pkgs/build-support/trivial-builders.nix b/pkgs/build-support/trivial-builders.nix
index 73f4d7783c43..18e49105ae78 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 85e74461d2a4..5b50167d9b9f 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