mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
stdenv: fix inputDerivation with passAsFile
passAsFile passes the values of Nix bindings to the builder as files, so if those values contained references, they wouldn't end up in the inputDerivation output. To fix that, append the contents of every such passed file to the output. We only have shell builtins in this derivation, so we can't use cat. The only way I know of appending the contents of one file to another using only shell builtins is as I've done here, but it requires putting the contents of the file on echo's argv. This might end up causing problems with large files. Regardless, I think we should try this, as a failure is better than silently producing an incorrect result like the previous behavior.
This commit is contained in:
parent
884ffbd847
commit
a295c4566e
@ -545,7 +545,13 @@ lib.extendDerivation
|
||||
# binaries). By writing this to $out, Nix can find and register
|
||||
# them as runtime dependencies (since Nix greps for store paths
|
||||
# through $out to find them)
|
||||
args = [ "-c" "export > $out" ];
|
||||
args = [ "-c" ''
|
||||
export > $out
|
||||
for var in $passAsFile; do
|
||||
pathVar="''${var}Path"
|
||||
printf "%s" "$(< "''${!pathVar}")" >> $out
|
||||
done
|
||||
'' ];
|
||||
|
||||
# inputDerivation produces the inputs; not the outputs, so any
|
||||
# restrictions on what used to be the outputs don't serve a purpose
|
||||
|
Loading…
Reference in New Issue
Block a user