google-chrome: replace bundled libvulkan.so.1 with vulkan-loader's

When Chrome run by `google-chrome-stable --use-vulkan --enable-features=Vulkan`
without this, it fails to create vk instance giving the below log:

[216457:216457:1003/211719.770352:ERROR:vulkan_instance.cc(112)] Failed to load 'libvulkan.so.1': libvulkan.so.1: cannot open shared object file: No such file or directory
[216457:216457:1003/211719.770434:ERROR:gpu_init.cc(1209)] Failed to create and initialize Vulkan implementation.

Closes https://github.com/NixOS/nixpkgs/issues/346197

Signed-off-by: John Titor <50095635+JohnRTitor@users.noreply.github.com>
This commit is contained in:
John Titor 2024-10-03 23:38:22 +05:30
parent 1f52ea5b8d
commit cd0a0dac68
No known key found for this signature in database
GPG Key ID: 29B0514F4E3C1CC0

View File

@ -44,6 +44,7 @@
nss,
pango,
pipewire,
vulkan-loader,
wayland, # ozone/wayland
# Command line programs
@ -152,6 +153,7 @@ let
speechd-minimal
systemd
util-linux
vulkan-loader
wayland
wget
]
@ -209,9 +211,12 @@ let
exe=$out/bin/google-chrome-$dist
mkdir -p $out/bin $out/share
cp -v -a opt/* $out/share
cp -v -a usr/share/* $out/share
cp -a opt/* $out/share
cp -a usr/share/* $out/share
# replace bundled vulkan-loader
rm -v $out/share/google/$appname/libvulkan.so.1
ln -v -s -t "$out/share/google/$appname" "${lib.getLib vulkan-loader}/lib/libvulkan.so.1"
substituteInPlace $out/share/google/$appname/google-$appname \
--replace-fail 'CHROME_WRAPPER' 'WRAPPER'