2016-04-28 22:29:29 +01:00
|
|
|
{ stdenv, fetchurl, makeDesktopItem
|
2016-09-11 22:24:51 +01:00
|
|
|
, libXrender, libX11, libXext, libXt, alsaLib, dbus, dbus_glib, glib, gtk2
|
2016-04-28 22:29:29 +01:00
|
|
|
, atk, pango, freetype, fontconfig, gdk_pixbuf, cairo, zlib
|
2016-12-14 01:54:13 +00:00
|
|
|
, gstreamer, gst_plugins_base, gst_plugins_good, gst_ffmpeg, gmp, ffmpeg
|
2016-12-14 02:09:44 +00:00
|
|
|
, libpulseaudio
|
2016-04-28 22:29:29 +01:00
|
|
|
}:
|
2014-01-12 22:04:14 +00:00
|
|
|
|
2016-04-28 22:29:29 +01:00
|
|
|
let
|
|
|
|
libPath = stdenv.lib.makeLibraryPath [
|
2016-09-11 22:24:51 +01:00
|
|
|
stdenv.cc.cc zlib glib alsaLib dbus dbus_glib gtk2 atk pango freetype
|
2016-04-28 22:29:29 +01:00
|
|
|
fontconfig gdk_pixbuf cairo libXrender libX11 libXext libXt
|
2016-12-14 01:54:13 +00:00
|
|
|
gstreamer gst_plugins_base gmp ffmpeg
|
2016-12-14 02:09:44 +00:00
|
|
|
libpulseaudio
|
|
|
|
] ;
|
2016-12-14 01:54:13 +00:00
|
|
|
|
|
|
|
gstPlugins = [ gstreamer gst_plugins_base gst_plugins_good gst_ffmpeg ];
|
|
|
|
|
|
|
|
gstPluginsPath = stdenv.lib.concatMapStringsSep ":" (x:
|
|
|
|
"${x}/lib/gstreamer-0.10") gstPlugins;
|
2016-04-28 22:29:29 +01:00
|
|
|
in
|
2014-03-01 21:37:39 +00:00
|
|
|
|
2016-04-28 22:29:29 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2014-01-12 22:04:14 +00:00
|
|
|
name = "tor-browser-${version}";
|
2016-12-13 22:46:29 +00:00
|
|
|
version = "6.0.8";
|
2014-01-12 22:04:14 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2015-06-19 12:04:18 +01:00
|
|
|
url = "https://archive.torproject.org/tor-package-archive/torbrowser/${version}/tor-browser-linux${if stdenv.is64bit then "64" else "32"}-${version}_en-US.tar.xz";
|
|
|
|
sha256 = if stdenv.is64bit then
|
2016-12-13 22:46:29 +00:00
|
|
|
"1s2yv72kj4zxba0850fi1jv41c69vcw3inhj9kqhy1d45ql7iw0w" else
|
|
|
|
"0zvqf444h35ikv1f3nwkh2jx51zj5k9w4zdxx32zcrnxpk5nhn97";
|
2016-01-07 06:55:09 +00:00
|
|
|
};
|
|
|
|
|
2016-12-14 02:43:47 +00:00
|
|
|
preferLocalBuild = true;
|
|
|
|
|
2016-01-07 06:55:09 +00:00
|
|
|
desktopItem = makeDesktopItem {
|
|
|
|
name = "torbrowser";
|
|
|
|
exec = "tor-browser";
|
|
|
|
icon = "torbrowser";
|
|
|
|
desktopName = "Tor Browser";
|
|
|
|
genericName = "Tor Browser";
|
|
|
|
comment = meta.description;
|
|
|
|
categories = "Network;WebBrowser;Security;";
|
2014-01-12 22:04:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patchPhase = ''
|
2014-12-17 18:11:30 +00:00
|
|
|
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" Browser/firefox
|
|
|
|
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" Browser/TorBrowser/Tor/tor
|
2016-05-01 20:23:03 +01:00
|
|
|
|
|
|
|
sed -e "s,./TorBrowser,$out/share/tor-browser/Browser/TorBrowser,g" -i Browser/TorBrowser/Data/Tor/torrc-defaults
|
2014-01-12 22:04:14 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
checkPhase = ''
|
|
|
|
echo "Checking firefox..."
|
2016-04-28 22:29:29 +01:00
|
|
|
LD_LIBRARY_PATH=${libPath} Browser/firefox --help 1> /dev/null
|
2014-01-12 22:04:14 +00:00
|
|
|
echo "Checking tor..."
|
2016-04-28 22:29:29 +01:00
|
|
|
LD_LIBRARY_PATH=${libPath}:Browser/TorBrowser/Tor Browser/TorBrowser/Tor/tor --help 1> /dev/null
|
2014-01-12 22:04:14 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2014-06-30 13:56:10 +01:00
|
|
|
mkdir -p $out/share/tor-browser
|
|
|
|
mkdir -p $out/bin
|
2014-01-12 22:04:14 +00:00
|
|
|
cp -R * $out/share/tor-browser
|
|
|
|
|
|
|
|
cat > "$out/bin/tor-browser" << EOF
|
2016-04-29 17:42:09 +01:00
|
|
|
#! ${stdenv.shell}
|
|
|
|
unset SESSION_MANAGER
|
2016-01-05 17:00:49 +00:00
|
|
|
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
|
2016-05-31 22:28:03 +01:00
|
|
|
echo "pref(\"extensions.torlauncher.torrc-defaults_path\", \"\$HOME/Data/Tor/torrc-defaults\");" >> \
|
|
|
|
~/Data/Browser/profile.default/preferences/extension-overrides.js
|
|
|
|
echo "pref(\"extensions.torlauncher.tor_path\", \"$out/share/tor-browser/Browser/TorBrowser/Tor/tor\");" >> \
|
|
|
|
~/Data/Browser/profile.default/preferences/extension-overrides.js
|
2016-01-05 17:00:49 +00:00
|
|
|
fi
|
2016-04-29 17:42:09 +01:00
|
|
|
export FONTCONFIG_PATH=\$HOME/Data/fontconfig
|
2016-04-28 22:29:29 +01:00
|
|
|
export LD_LIBRARY_PATH=${libPath}:$out/share/tor-browser/Browser/TorBrowser/Tor
|
2016-12-14 01:54:13 +00:00
|
|
|
export GST_PLUGIN_SYSTEM_PATH=${gstPluginsPath}
|
2016-04-29 17:42:09 +01:00
|
|
|
exec $out/share/tor-browser/Browser/firefox --class "Tor Browser" -no-remote -profile ~/Data/Browser/profile.default "\$@"
|
2014-01-12 22:04:14 +00:00
|
|
|
EOF
|
|
|
|
chmod +x $out/bin/tor-browser
|
2016-01-07 06:55:09 +00:00
|
|
|
|
|
|
|
mkdir -p $out/share/applications
|
|
|
|
cp $desktopItem/share/applications"/"* $out/share/applications
|
|
|
|
|
|
|
|
mkdir -p $out/share/pixmaps
|
|
|
|
cp Browser/browser/icons/mozicon128.png $out/share/pixmaps/torbrowser.png
|
2014-01-12 22:04:14 +00:00
|
|
|
'';
|
|
|
|
|
2016-01-07 06:55:09 +00:00
|
|
|
meta = with stdenv.lib; {
|
2014-12-06 10:43:06 +00:00
|
|
|
description = "Tor Browser Bundle";
|
|
|
|
homepage = https://www.torproject.org/;
|
2016-01-07 06:55:09 +00:00
|
|
|
platforms = platforms.linux;
|
2016-04-28 18:21:42 +01:00
|
|
|
maintainers = with maintainers; [ offline matejc doublec thoughtpolice joachifm ];
|
2014-01-12 22:04:14 +00:00
|
|
|
};
|
|
|
|
}
|