about summary refs log tree commit diff
path: root/pkgs/applications/networking/browsers
diff options
context:
space:
mode:
authorBrandon Weeks <me@brandonweeks.com>2022-01-17 15:15:18 -0800
committerMichael Weiss <dev.primeos@gmail.com>2022-02-06 20:21:37 +0100
commit4ec7d05099f639e8370ed3506d1a7b17af1ceb6b (patch)
tree41bda92215900c7084dbde2cb67b96b25c39c6e4 /pkgs/applications/networking/browsers
parent189f73465b9b1c7534e28e327283c4cdd34ddf41 (diff)
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
Diffstat (limited to 'pkgs/applications/networking/browsers')
-rw-r--r--pkgs/applications/networking/browsers/google-chrome/default.nix4
1 files changed, 4 insertions, 0 deletions
diff --git a/pkgs/applications/networking/browsers/google-chrome/default.nix b/pkgs/applications/networking/browsers/google-chrome/default.nix
index f1da103157b98..d1fd9f05ccbc0 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}}"