From cd0a0dac6867f11b046f0195b13e5c57fa13cdcb Mon Sep 17 00:00:00 2001 From: John Titor <50095635+JohnRTitor@users.noreply.github.com> Date: Thu, 3 Oct 2024 23:38:22 +0530 Subject: [PATCH] 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> --- pkgs/by-name/go/google-chrome/package.nix | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/go/google-chrome/package.nix b/pkgs/by-name/go/google-chrome/package.nix index 5ed9085e9ffc..81aaeecad36e 100644 --- a/pkgs/by-name/go/google-chrome/package.nix +++ b/pkgs/by-name/go/google-chrome/package.nix @@ -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'