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
main
Brandon Weeks 2 years ago committed by Michael Weiss
parent 189f73465b
commit 4ec7d05099
No known key found for this signature in database
GPG Key ID: 5BE487C4D4771D83
  1. 4
      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}}"

Loading…
Cancel
Save