summary refs log tree commit diff
path: root/pkgs/applications/version-management/sublime-merge/common.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/version-management/sublime-merge/common.nix')
-rw-r--r--pkgs/applications/version-management/sublime-merge/common.nix14
1 files changed, 12 insertions, 2 deletions
diff --git a/pkgs/applications/version-management/sublime-merge/common.nix b/pkgs/applications/version-management/sublime-merge/common.nix
index 173333fb75c..ad540c46411 100644
--- a/pkgs/applications/version-management/sublime-merge/common.nix
+++ b/pkgs/applications/version-management/sublime-merge/common.nix
@@ -1,6 +1,6 @@
 { buildVersion, sha256, dev ? false }:
 
-{ fetchurl, stdenv, xorg, glib, glibcLocales, gtk3, cairo, pango, libredirect, makeWrapper, wrapGAppsHook
+{ fetchurl, stdenv, xorg, glib, libGL, glibcLocales, gtk3, cairo, pango, libredirect, makeWrapper, wrapGAppsHook
 , pkexecPath ? "/run/wrappers/bin/pkexec"
 , writeScript, common-updater-scripts, curl, gnugrep, coreutils
 }:
@@ -40,7 +40,7 @@ in let
       for binary in ${ builtins.concatStringsSep " " binaries }; do
         patchelf \
           --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
-          --set-rpath ${libPath}:${stdenv.cc.cc.lib}/lib${stdenv.lib.optionalString stdenv.is64bit "64"} \
+          --set-rpath ${libPath}:${libGL}/lib:${stdenv.cc.cc.lib}/lib${stdenv.lib.optionalString stdenv.is64bit "64"} \
           $binary
       done
 
@@ -67,6 +67,16 @@ in let
         --set NIX_REDIRECTS ${builtins.concatStringsSep ":" redirects} \
         --set LOCALE_ARCHIVE "${glibcLocales.out}/lib/locale/locale-archive" \
         "''${gappsWrapperArgs[@]}"
+
+      # We need to replace the ssh-askpass-sublime executable because the default one
+      # will not function properly, in order to work it needs to pass an argv[0] to
+      # the sublime_merge binary, and the built-in version will will try to call the
+      # sublime_merge wrapper script which cannot pass through the original argv[0] to
+      # the sublime_merge binary. Thankfully the ssh-askpass-sublime functionality is
+      # very simple and can be replaced with a simple wrapper script.
+      rm $out/ssh-askpass-sublime
+      makeWrapper $out/.${primaryBinary}-wrapped $out/ssh-askpass-sublime \
+        --argv0 "/ssh-askpass-sublime"
     '';
   };
 in stdenv.mkDerivation (rec {