From 4ec7d05099f639e8370ed3506d1a7b17af1ceb6b Mon Sep 17 00:00:00 2001 From: Brandon Weeks Date: Mon, 17 Jan 2022 15:15:18 -0800 Subject: [PATCH] google-chrome: passthrough CHROME_WRAPPER environment variable The XDG desktop menu entries created by Chrome for Progressive Web Apps are currently broken due to Exec being set to the path of the upstream Chrome wrapper instead of the Nixpkgs wrapper. This causes Chrome to crash becaues LD_LIBRARY_PATH is not set. Chrome obtains the path to be included in the menu entry from the CHROME_WRAPPER environment variable, which is currently set by the upstream wrapper to its own path. By setting the variable to the path of the Nixpkgs wrapper instead, launching PWAs works as expected. https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/shell_integration_linux.cc https://source.chromium.org/chromium/chromium/src/+/main:chrome/installer/linux/common/wrapper --- .../networking/browsers/google-chrome/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/applications/networking/browsers/google-chrome/default.nix b/pkgs/applications/networking/browsers/google-chrome/default.nix index f1da103157b9..d1fd9f05ccbc 100644 --- a/pkgs/applications/networking/browsers/google-chrome/default.nix +++ b/pkgs/applications/networking/browsers/google-chrome/default.nix @@ -118,6 +118,9 @@ in stdenv.mkDerivation { cp -a opt/* $out/share cp -a usr/share/* $out/share + + substituteInPlace $out/share/google/$appname/google-$appname \ + --replace 'CHROME_WRAPPER' 'WRAPPER' substituteInPlace $out/share/applications/google-$appname.desktop \ --replace /usr/bin/google-chrome-$dist $exe substituteInPlace $out/share/gnome-control-center/default-apps/google-$appname.xml \ @@ -143,6 +146,7 @@ in stdenv.mkDerivation { --prefix LD_LIBRARY_PATH : "$rpath" \ --prefix PATH : "$binpath" \ --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH:${addOpenGLRunpath.driverLink}/share" \ + --set CHROME_WRAPPER "google-chrome-$dist" \ --add-flags ${escapeShellArg commandLineArgs} \ --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--enable-features=UseOzonePlatform --ozone-platform=wayland}}"