buildBazelPackage: only rewrite relevant symlinks

This commit is contained in:
Luke Granger-Brown 2021-01-08 01:34:58 +00:00
parent 76fad08473
commit c7102b26ce

View File

@ -172,7 +172,9 @@ in stdenv.mkDerivation (fBuildAttrs // {
chmod -R +w $bazelOut
find $bazelOut -type l | while read symlink; do
ln -sf $(readlink "$symlink" | sed "s,NIX_BUILD_TOP,$NIX_BUILD_TOP,") "$symlink"
if [[ $(readlink "$symlink") == *NIX_BUILD_TOP* ]]; then
ln -sf $(readlink "$symlink" | sed "s,NIX_BUILD_TOP,$NIX_BUILD_TOP,") "$symlink"
fi
done
'' + fBuildAttrs.preConfigure or "";