about summary refs log tree commit diff
path: root/pkgs/build-support/buildenv/default.nix
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2019-02-20 10:41:20 +0100
committerFrederik Rietdijk <freddyrietdijk@fridh.nl>2019-02-21 10:37:42 +0100
commit9fcd3bffc2f6d5d91d72973eca3cc5b2993fddba (patch)
treed2ac1a13efde0b59eacf41e24fe68ad118611217 /pkgs/build-support/buildenv/default.nix
parente2cd07b9978198696681776405c4e23526d483a7 (diff)
downloadnixlib-9fcd3bffc2f6d5d91d72973eca3cc5b2993fddba.tar
nixlib-9fcd3bffc2f6d5d91d72973eca3cc5b2993fddba.tar.gz
nixlib-9fcd3bffc2f6d5d91d72973eca3cc5b2993fddba.tar.bz2
nixlib-9fcd3bffc2f6d5d91d72973eca3cc5b2993fddba.tar.lz
nixlib-9fcd3bffc2f6d5d91d72973eca3cc5b2993fddba.tar.xz
nixlib-9fcd3bffc2f6d5d91d72973eca3cc5b2993fddba.tar.zst
nixlib-9fcd3bffc2f6d5d91d72973eca3cc5b2993fddba.zip
buildEnv: improve file check to avoid false-positives
The original change in #55372 was supposed to fix the case where a store
path which is a file should be placed into `buildEnv` which broke with a
fairly misleading Perl error.

Unfortunately this introduced a regression, `findFiles` can have targets
that are files if the file isn't a store path. Rather than adding more
obscure checks with probably further regressions, I figured that it's
better to replicate the behavior of `lib.isStorePath` and explicitly
check if the store path is a file and break in this case only.

This should also fix recent staging issues.
Diffstat (limited to 'pkgs/build-support/buildenv/default.nix')
-rw-r--r--pkgs/build-support/buildenv/default.nix11
1 files changed, 9 insertions, 2 deletions
diff --git a/pkgs/build-support/buildenv/default.nix b/pkgs/build-support/buildenv/default.nix
index 41a1e67ef428..f858048d6947 100644
--- a/pkgs/build-support/buildenv/default.nix
+++ b/pkgs/build-support/buildenv/default.nix
@@ -2,7 +2,7 @@
 # a fork of the buildEnv in the Nix distribution.  Most changes should
 # eventually be merged back into the Nix distribution.
 
-{ buildPackages, runCommand, lib }:
+{ buildPackages, runCommand, lib, substituteAll }:
 
 lib.makeOverridable
 ({ name
@@ -43,6 +43,13 @@ lib.makeOverridable
 , meta ? {}
 }:
 
+let
+  builder = substituteAll {
+    src = ./builder.pl;
+    inherit (builtins) storeDir;
+  };
+in
+
 runCommand name
   rec {
     inherit manifest ignoreCollisions checkCollisionContents passthru
@@ -67,6 +74,6 @@ runCommand name
     passAsFile = if builtins.stringLength pkgs >= 128*1024 then [ "pkgs" ] else null;
   }
   ''
-    ${buildPackages.perl}/bin/perl -w ${./builder.pl}
+    ${buildPackages.perl}/bin/perl -w ${builder}
     eval "$postBuild"
   '')