Merge pull request #15065 from joachifm/torbrowser-enhancements

Torbrowser enhancements
This commit is contained in:
Joachim Fasting 2016-04-30 17:42:01 +02:00
commit 9ec677867f
2 changed files with 21 additions and 26 deletions

View File

@ -1,21 +1,16 @@
{ stdenv, fetchurl, buildEnv, makeDesktopItem
, xorg, alsaLib, dbus, dbus_glib, glib, gtk, atk, pango, freetype, fontconfig
, gdk_pixbuf, cairo, zlib}:
{ stdenv, fetchurl, makeDesktopItem
, libXrender, libX11, libXext, libXt, alsaLib, dbus, dbus_glib, glib, gtk
, atk, pango, freetype, fontconfig, gdk_pixbuf, cairo, zlib
}:
let
# isolated tor environment
torEnv = buildEnv {
name = "tor-env";
paths = [
stdenv.cc.cc zlib glib alsaLib dbus dbus_glib gtk atk pango freetype
fontconfig gdk_pixbuf cairo xorg.libXrender xorg.libX11 xorg.libXext
xorg.libXt
];
extraOutputsToInstall = [ "lib" "out" ];
};
libPath = stdenv.lib.makeLibraryPath [
stdenv.cc.cc zlib glib alsaLib dbus dbus_glib gtk atk pango freetype
fontconfig gdk_pixbuf cairo libXrender libX11 libXext libXt
];
in
ldLibraryPath = ''${torEnv}/lib${stdenv.lib.optionalString stdenv.is64bit ":${torEnv}/lib64"}'';
in stdenv.mkDerivation rec {
stdenv.mkDerivation rec {
name = "tor-browser-${version}";
version = "5.5.5";
@ -43,12 +38,10 @@ in stdenv.mkDerivation rec {
doCheck = true;
checkPhase = ''
# Just do a simple test if all libraries get loaded by running help on
# firefox and tor
echo "Checking firefox..."
LD_LIBRARY_PATH=${ldLibraryPath} Browser/firefox --help 1> /dev/null
LD_LIBRARY_PATH=${libPath} Browser/firefox --help 1> /dev/null
echo "Checking tor..."
LD_LIBRARY_PATH=${torEnv}/lib:Browser/TorBrowser/Tor Browser/TorBrowser/Tor/tor --help 1> /dev/null
LD_LIBRARY_PATH=${libPath}:Browser/TorBrowser/Tor Browser/TorBrowser/Tor/tor --help 1> /dev/null
'';
installPhase = ''
@ -57,15 +50,17 @@ in stdenv.mkDerivation rec {
cp -R * $out/share/tor-browser
cat > "$out/bin/tor-browser" << EOF
#!${stdenv.shell}
#! ${stdenv.shell}
unset SESSION_MANAGER
export HOME="\$HOME/.torbrowser4"
if [ ! -d \$HOME ]; then
mkdir -p \$HOME && cp -R $out/share/tor-browser/Browser/TorBrowser/Data \$HOME/ && chmod -R +w \$HOME
echo "pref(\"extensions.torlauncher.tordatadir_path\", \"\$HOME/Data/Tor/\");" >> \
~/Data/Browser/profile.default/preferences/extension-overrides.js
fi
export LD_LIBRARY_PATH=${ldLibraryPath}:$out/share/tor-browser/Browser/TorBrowser/Tor
$out/share/tor-browser/Browser/firefox -no-remote -profile ~/Data/Browser/profile.default "\$@"
export FONTCONFIG_PATH=\$HOME/Data/fontconfig
export LD_LIBRARY_PATH=${libPath}:$out/share/tor-browser/Browser/TorBrowser/Tor
exec $out/share/tor-browser/Browser/firefox --class "Tor Browser" -no-remote -profile ~/Data/Browser/profile.default "\$@"
EOF
chmod +x $out/bin/tor-browser
@ -76,8 +71,6 @@ in stdenv.mkDerivation rec {
cp Browser/browser/icons/mozicon128.png $out/share/pixmaps/torbrowser.png
'';
buildInputs = [ stdenv ];
meta = with stdenv.lib; {
description = "Tor Browser Bundle";
homepage = https://www.torproject.org/;

View File

@ -3462,7 +3462,9 @@ in
torbutton = callPackage ../tools/security/torbutton { };
torbrowser = callPackage ../tools/security/tor/torbrowser.nix { };
torbrowser = callPackage ../tools/security/tor/torbrowser.nix {
inherit (xorg) libXrender libX11 libXext libXt;
};
touchegg = callPackage ../tools/inputmethods/touchegg { };