sublime3: add pkexec and gksudo support
This commit is contained in:
parent
0cea20a652
commit
c66f8b293b
1 changed files with 13 additions and 1 deletions
|
@ -1,10 +1,15 @@
|
|||
{ fetchurl, stdenv, glib, xorg, cairo, gtk, pango, makeWrapper, openssl, bzip2 }:
|
||||
{ fetchurl, stdenv, glib, xorg, cairo, gtk, pango, makeWrapper, openssl, bzip2,
|
||||
pkexecPath ? "/var/setuid-wrappers/pkexec", libredirect,
|
||||
gksuSupport ? false, gksu}:
|
||||
|
||||
assert stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux";
|
||||
assert gksuSupport -> gksu != null;
|
||||
|
||||
let
|
||||
build = "3083";
|
||||
libPath = stdenv.lib.makeLibraryPath [glib xorg.libX11 gtk cairo pango];
|
||||
redirects = [ "/usr/bin/pkexec=${pkexecPath}" ]
|
||||
++ stdenv.lib.optional gksuSupport "/usr/bin/gksudo=${gksu}/bin/gksudo";
|
||||
in let
|
||||
# package with just the binaries
|
||||
sublime = stdenv.mkDerivation {
|
||||
|
@ -35,6 +40,9 @@ in let
|
|||
--set-rpath ${libPath}:${stdenv.cc.cc}/lib${stdenv.lib.optionalString stdenv.is64bit "64"} \
|
||||
$i
|
||||
done
|
||||
|
||||
# Rewrite pkexec|gksudo argument. Note that we can't delete bytes in binary.
|
||||
sed -i -e 's,/bin/cp\x00,cp\x00\x00\x00\x00\x00\x00,g' sublime_text
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
|
@ -44,6 +52,10 @@ in let
|
|||
mkdir -p $out
|
||||
cp -prvd * $out/
|
||||
|
||||
wrapProgram $out/sublime_text \
|
||||
--set LD_PRELOAD "${libredirect}/lib/libredirect.so" \
|
||||
--set NIX_REDIRECTS ${builtins.concatStringsSep ":" redirects}
|
||||
|
||||
# Without this, plugin_host crashes, even though it has the rpath
|
||||
wrapProgram $out/plugin_host --prefix LD_PRELOAD : ${stdenv.cc.cc}/lib${stdenv.lib.optionalString stdenv.is64bit "64"}/libgcc_s.so.1:${openssl}/lib/libssl.so:${bzip2}/lib/libbz2.so
|
||||
'';
|
||||
|
|
Loading…
Reference in a new issue