sublime3: add pkexec and gksudo support
This commit is contained in:
parent
0cea20a652
commit
c66f8b293b
@ -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 stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux";
|
||||||
|
assert gksuSupport -> gksu != null;
|
||||||
|
|
||||||
let
|
let
|
||||||
build = "3083";
|
build = "3083";
|
||||||
libPath = stdenv.lib.makeLibraryPath [glib xorg.libX11 gtk cairo pango];
|
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
|
in let
|
||||||
# package with just the binaries
|
# package with just the binaries
|
||||||
sublime = stdenv.mkDerivation {
|
sublime = stdenv.mkDerivation {
|
||||||
@ -35,6 +40,9 @@ in let
|
|||||||
--set-rpath ${libPath}:${stdenv.cc.cc}/lib${stdenv.lib.optionalString stdenv.is64bit "64"} \
|
--set-rpath ${libPath}:${stdenv.cc.cc}/lib${stdenv.lib.optionalString stdenv.is64bit "64"} \
|
||||||
$i
|
$i
|
||||||
done
|
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 = ''
|
installPhase = ''
|
||||||
@ -44,6 +52,10 @@ in let
|
|||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
cp -prvd * $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
|
# 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
|
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…
x
Reference in New Issue
Block a user