Skip to content

Commit

Permalink
nvidia-x11: Make vulkan library path absolute for >= 435.
Browse files Browse the repository at this point in the history
The original file contains just a library name, which does not work when LD_LIBRARY_PATH does not contain /run/opengl-driver/lib, as is the case in unstable NixOS.

Fixes #69264
  • Loading branch information
ambrop72 authored and abbradar committed Oct 2, 2019
1 parent 9d9aa60 commit d156b2b
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions pkgs/os-specific/linux/nvidia-x11/builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,24 @@ installPhase() {
mv $i/lib/libvdpau* $i/lib/vdpau

# Install ICDs, make absolute paths.
# Be careful not to modify any original files because this runs twice.

# OpenCL
sed -E "s#(libnvidia-opencl)#$i/lib/\\1#" nvidia.icd > nvidia.icd.fixed
install -Dm644 nvidia.icd.fixed $i/etc/OpenCL/vendors/nvidia.icd
if [ -e nvidia_icd.json.template ]; then
# template patching for version < 435
sed "s#__NV_VK_ICD__#$i/lib/libGLX_nvidia.so#" nvidia_icd.json.template > nvidia_icd.json
fi
if [ -e nvidia_icd.json ]; then
install -Dm644 nvidia_icd.json $i/share/vulkan/icd.d/nvidia.json

# Vulkan
if [ -e nvidia_icd.json.template ] || [ -e nvidia_icd.json ]; then
if [ -e nvidia_icd.json.template ]; then
# template patching for version < 435
sed "s#__NV_VK_ICD__#$i/lib/libGLX_nvidia.so#" nvidia_icd.json.template > nvidia_icd.json.fixed
else
sed -E "s#(libGLX_nvidia)#$i/lib/\\1#" nvidia_icd.json > nvidia_icd.json.fixed
fi
install -Dm644 nvidia_icd.json.fixed $i/share/vulkan/icd.d/nvidia.json
fi

# EGL
if [ "$useGLVND" = "1" ]; then
sed -E "s#(libEGL_nvidia)#$i/lib/\\1#" 10_nvidia.json > 10_nvidia.json.fixed
install -Dm644 10_nvidia.json.fixed $i/share/glvnd/egl_vendor.d/nvidia.json
Expand Down

0 comments on commit d156b2b

Please sign in to comment.