2017-03-25 14:59:13 +00:00
|
|
|
{ stdenv
|
|
|
|
, fetchurl
|
|
|
|
, makeDesktopItem
|
|
|
|
|
|
|
|
# Common run-time dependencies
|
|
|
|
, zlib
|
|
|
|
|
|
|
|
# libxul run-time dependencies
|
|
|
|
, atk
|
|
|
|
, cairo
|
|
|
|
, dbus
|
2018-02-25 02:23:58 +00:00
|
|
|
, dbus-glib
|
2017-03-25 14:59:13 +00:00
|
|
|
, fontconfig
|
|
|
|
, freetype
|
2019-05-22 12:03:39 +01:00
|
|
|
, gdk-pixbuf
|
2017-03-25 14:59:13 +00:00
|
|
|
, glib
|
2018-09-11 11:33:02 +01:00
|
|
|
, gtk3
|
2017-06-07 18:04:51 +01:00
|
|
|
, libxcb
|
2017-03-25 14:59:13 +00:00
|
|
|
, libX11
|
|
|
|
, libXext
|
|
|
|
, libXrender
|
|
|
|
, libXt
|
|
|
|
, pango
|
|
|
|
|
2017-06-07 18:04:51 +01:00
|
|
|
, audioSupport ? mediaSupport
|
2017-09-23 17:25:42 +01:00
|
|
|
, pulseaudioSupport ? false
|
2017-03-25 14:59:13 +00:00
|
|
|
, libpulseaudio
|
2017-09-23 17:25:42 +01:00
|
|
|
, apulse
|
2017-03-25 14:59:13 +00:00
|
|
|
|
2017-09-23 17:25:42 +01:00
|
|
|
# Media support (implies audio support)
|
2020-03-17 20:48:32 +00:00
|
|
|
, mediaSupport ? true
|
2020-06-07 13:39:09 +01:00
|
|
|
, ffmpeg_3
|
2017-03-26 12:49:24 +01:00
|
|
|
|
2018-11-14 22:29:48 +00:00
|
|
|
, gmp
|
|
|
|
|
2017-03-26 12:49:24 +01:00
|
|
|
# Pluggable transport dependencies
|
|
|
|
, python27
|
2017-07-13 08:57:10 +01:00
|
|
|
|
2017-08-20 01:13:22 +01:00
|
|
|
# Wrapper runtime
|
|
|
|
, coreutils
|
|
|
|
, glibcLocales
|
2019-02-13 21:47:50 +00:00
|
|
|
, gnome3
|
2018-09-13 16:41:56 +01:00
|
|
|
, runtimeShell
|
2018-02-25 02:23:58 +00:00
|
|
|
, shared-mime-info
|
2018-09-13 16:37:57 +01:00
|
|
|
, gsettings-desktop-schemas
|
2017-08-20 01:13:22 +01:00
|
|
|
|
2019-09-24 09:28:37 +01:00
|
|
|
# Hardening
|
|
|
|
, graphene-hardened-malloc
|
|
|
|
, useHardenedMalloc ? graphene-hardened-malloc != null && builtins.elem stdenv.system graphene-hardened-malloc.meta.platforms
|
|
|
|
|
2017-09-15 10:41:49 +01:00
|
|
|
# Whether to disable multiprocess support to work around crashing tabs
|
|
|
|
# TODO: fix the underlying problem instead of this terrible work-around
|
|
|
|
, disableContentSandbox ? true
|
|
|
|
|
2017-07-13 08:57:10 +01:00
|
|
|
# Extra preferences
|
|
|
|
, extraPrefs ? ""
|
2017-03-25 14:59:13 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
with stdenv.lib;
|
|
|
|
|
|
|
|
let
|
2017-08-20 01:13:22 +01:00
|
|
|
libPath = makeLibraryPath libPkgs;
|
|
|
|
|
|
|
|
libPkgs = [
|
2017-03-25 14:59:13 +00:00
|
|
|
atk
|
|
|
|
cairo
|
|
|
|
dbus
|
2018-02-25 02:23:58 +00:00
|
|
|
dbus-glib
|
2017-03-25 14:59:13 +00:00
|
|
|
fontconfig
|
|
|
|
freetype
|
2019-05-22 12:03:39 +01:00
|
|
|
gdk-pixbuf
|
2017-03-25 14:59:13 +00:00
|
|
|
glib
|
2018-09-11 11:33:02 +01:00
|
|
|
gtk3
|
2017-06-07 18:04:51 +01:00
|
|
|
libxcb
|
2017-03-25 14:59:13 +00:00
|
|
|
libX11
|
|
|
|
libXext
|
|
|
|
libXrender
|
|
|
|
libXt
|
|
|
|
pango
|
|
|
|
stdenv.cc.cc
|
2017-08-20 01:13:22 +01:00
|
|
|
stdenv.cc.libc
|
2017-03-25 14:59:13 +00:00
|
|
|
zlib
|
|
|
|
]
|
|
|
|
++ optionals pulseaudioSupport [ libpulseaudio ]
|
|
|
|
++ optionals mediaSupport [
|
2020-06-07 13:39:09 +01:00
|
|
|
ffmpeg_3
|
2017-08-20 01:13:22 +01:00
|
|
|
];
|
2017-03-25 14:59:13 +00:00
|
|
|
|
2017-03-26 12:49:24 +01:00
|
|
|
# Library search path for the fte transport
|
|
|
|
fteLibPath = makeLibraryPath [ stdenv.cc.cc gmp ];
|
|
|
|
|
2017-03-25 14:59:13 +00:00
|
|
|
# Upstream source
|
2020-06-03 06:46:00 +01:00
|
|
|
version = "9.5";
|
2017-03-25 14:59:13 +00:00
|
|
|
|
|
|
|
lang = "en-US";
|
|
|
|
|
|
|
|
srcs = {
|
2019-08-13 22:52:01 +01:00
|
|
|
x86_64-linux = fetchurl {
|
2019-09-13 09:09:44 +01:00
|
|
|
url = "https://dist.torproject.org/torbrowser/${version}/tor-browser-linux64-${version}_${lang}.tar.xz";
|
2020-06-03 06:46:00 +01:00
|
|
|
sha256 = "0l4fz2zkgwv2qniia4nv53a4pd79hfbgb66jn68r44diails1z08";
|
2017-03-25 14:59:13 +00:00
|
|
|
};
|
|
|
|
|
2019-08-13 22:52:01 +01:00
|
|
|
i686-linux = fetchurl {
|
2019-10-23 18:21:03 +01:00
|
|
|
url = "https://dist.torproject.org/torbrowser/${version}/tor-browser-linux32-${version}_${lang}.tar.xz";
|
2020-06-03 06:46:00 +01:00
|
|
|
sha256 = "1h4awhyaiws68s727pq9r32xqg2878dl2df4kbc2nmllwrl2fxq3";
|
2017-03-25 14:59:13 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "tor-browser-bundle-bin";
|
2017-03-25 14:59:13 +00:00
|
|
|
inherit version;
|
|
|
|
|
2019-08-13 22:52:01 +01:00
|
|
|
src = srcs.${stdenv.hostPlatform.system} or (throw "unsupported system: ${stdenv.hostPlatform.system}");
|
2017-03-25 14:59:13 +00:00
|
|
|
|
|
|
|
preferLocalBuild = true;
|
2017-05-28 19:06:19 +01:00
|
|
|
allowSubstitutes = false;
|
2017-03-25 14:59:13 +00:00
|
|
|
|
|
|
|
desktopItem = makeDesktopItem {
|
|
|
|
name = "torbrowser";
|
|
|
|
exec = "tor-browser";
|
|
|
|
icon = "torbrowser";
|
|
|
|
desktopName = "Tor Browser";
|
|
|
|
genericName = "Web Browser";
|
|
|
|
comment = meta.description;
|
|
|
|
categories = "Network;WebBrowser;Security;";
|
|
|
|
};
|
|
|
|
|
|
|
|
buildCommand = ''
|
|
|
|
# For convenience ...
|
|
|
|
TBB_IN_STORE=$out/share/tor-browser
|
|
|
|
interp=$(< $NIX_CC/nix-support/dynamic-linker)
|
|
|
|
|
|
|
|
# Unpack & enter
|
|
|
|
mkdir -p "$TBB_IN_STORE"
|
|
|
|
tar xf "${src}" -C "$TBB_IN_STORE" --strip-components=2
|
|
|
|
pushd "$TBB_IN_STORE"
|
|
|
|
|
|
|
|
# Set ELF interpreter
|
2018-09-11 11:33:02 +01:00
|
|
|
for exe in firefox.real TorBrowser/Tor/tor ; do
|
|
|
|
echo "Setting ELF interpreter on $exe ..." >&2
|
2017-03-25 14:59:13 +00:00
|
|
|
patchelf --set-interpreter "$interp" "$exe"
|
|
|
|
done
|
|
|
|
|
2018-09-11 11:33:02 +01:00
|
|
|
# firefox is a wrapper that checks for a more recent libstdc++ & appends it to the ld path
|
|
|
|
mv firefox.real firefox
|
|
|
|
|
2017-03-25 14:59:13 +00:00
|
|
|
# The final libPath. Note, we could split this into firefoxLibPath
|
|
|
|
# and torLibPath for accuracy, but this is more convenient ...
|
|
|
|
libPath=${libPath}:$TBB_IN_STORE:$TBB_IN_STORE/TorBrowser/Tor
|
|
|
|
|
2017-09-23 17:25:42 +01:00
|
|
|
# apulse uses a non-standard library path. For now special-case it.
|
|
|
|
${optionalString (audioSupport && !pulseaudioSupport) ''
|
|
|
|
libPath=${apulse}/lib/apulse:$libPath
|
|
|
|
''}
|
|
|
|
|
2017-03-26 12:49:24 +01:00
|
|
|
# Fixup paths to pluggable transports.
|
|
|
|
sed -i TorBrowser/Data/Tor/torrc-defaults \
|
|
|
|
-e "s,./TorBrowser,$TBB_IN_STORE/TorBrowser,g"
|
|
|
|
|
|
|
|
# Fixup obfs transport. Work around patchelf failing to set
|
|
|
|
# interpreter for pre-compiled Go binaries by invoking the interpreter
|
|
|
|
# directly.
|
|
|
|
sed -i TorBrowser/Data/Tor/torrc-defaults \
|
2019-10-23 18:21:03 +01:00
|
|
|
-e "s|\(ClientTransportPlugin meek_lite,obfs2,obfs3,obfs4,scramblesuit\) exec|\1 exec $interp|"
|
2017-03-26 12:49:24 +01:00
|
|
|
|
2019-10-23 18:21:03 +01:00
|
|
|
# Similarly fixup snowflake
|
|
|
|
sed -i TorBrowser/Data/Tor/torrc-defaults \
|
|
|
|
-e "s|\(ClientTransportPlugin snowflake\) exec|\1 exec $interp|"
|
2017-03-26 12:49:24 +01:00
|
|
|
|
|
|
|
|
2017-03-25 14:59:13 +00:00
|
|
|
# Prepare for autoconfig.
|
|
|
|
#
|
|
|
|
# See https://developer.mozilla.org/en-US/Firefox/Enterprise_deployment
|
|
|
|
cat >defaults/pref/autoconfig.js <<EOF
|
|
|
|
//
|
|
|
|
pref("general.config.filename", "mozilla.cfg");
|
|
|
|
pref("general.config.obscure_value", 0);
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# Hard-coded Firefox preferences.
|
|
|
|
cat >mozilla.cfg <<EOF
|
|
|
|
// First line must be a comment
|
|
|
|
|
2017-07-13 08:29:50 +01:00
|
|
|
// Always update via Nixpkgs
|
2017-03-25 14:59:13 +00:00
|
|
|
lockPref("app.update.auto", false);
|
|
|
|
lockPref("app.update.enabled", false);
|
|
|
|
lockPref("extensions.update.autoUpdateDefault", false);
|
|
|
|
lockPref("extensions.update.enabled", false);
|
2017-07-13 08:29:50 +01:00
|
|
|
lockPref("extensions.torbutton.versioncheck_enabled", false);
|
2017-03-25 14:59:13 +00:00
|
|
|
|
|
|
|
// User should never change these. Locking prevents these
|
|
|
|
// values from being written to prefs.js, avoiding Store
|
|
|
|
// path capture.
|
|
|
|
lockPref("extensions.torlauncher.torrc-defaults_path", "$TBB_IN_STORE/TorBrowser/Data/Tor/torrc-defaults");
|
|
|
|
lockPref("extensions.torlauncher.tor_path", "$TBB_IN_STORE/TorBrowser/Tor/tor");
|
|
|
|
|
|
|
|
// Reset pref that captures store paths.
|
|
|
|
clearPref("extensions.xpiState");
|
|
|
|
|
|
|
|
// Stop obnoxious first-run redirection.
|
|
|
|
lockPref("noscript.firstRunRedirection", false);
|
2017-07-04 14:09:39 +01:00
|
|
|
|
|
|
|
// Insist on using IPC for communicating with Tor
|
|
|
|
//
|
2018-09-11 11:33:02 +01:00
|
|
|
// Defaults to creating \$TBB_HOME/TorBrowser/Data/Tor/{socks,control}.socket
|
2017-07-04 14:09:39 +01:00
|
|
|
lockPref("extensions.torlauncher.control_port_use_ipc", true);
|
|
|
|
lockPref("extensions.torlauncher.socks_port_use_ipc", true);
|
2017-07-13 08:57:10 +01:00
|
|
|
|
2017-09-15 10:41:49 +01:00
|
|
|
// Optionally disable multiprocess support. We always set this to ensure that
|
|
|
|
// toggling the pref takes effect.
|
|
|
|
lockPref("browser.tabs.remote.autostart.2", ${if disableContentSandbox then "false" else "true"});
|
|
|
|
|
2017-09-23 17:25:42 +01:00
|
|
|
// Allow sandbox access to sound devices if using ALSA directly
|
|
|
|
${if (audioSupport && !pulseaudioSupport) then ''
|
|
|
|
pref("security.sandbox.content.write_path_whitelist", "/dev/snd/");
|
|
|
|
'' else ''
|
|
|
|
clearPref("security.sandbox.content.write_path_whitelist");
|
|
|
|
''}
|
|
|
|
|
2017-07-13 08:57:10 +01:00
|
|
|
${optionalString (extraPrefs != "") ''
|
|
|
|
${extraPrefs}
|
|
|
|
''}
|
2017-03-25 14:59:13 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
# Hard-code path to TBB fonts; see also FONTCONFIG_FILE in
|
|
|
|
# the wrapper below.
|
|
|
|
FONTCONFIG_FILE=$TBB_IN_STORE/TorBrowser/Data/fontconfig/fonts.conf
|
|
|
|
sed -i "$FONTCONFIG_FILE" \
|
|
|
|
-e "s,<dir>fonts</dir>,<dir>$TBB_IN_STORE/fonts</dir>,"
|
|
|
|
|
2017-10-20 14:24:20 +01:00
|
|
|
# Preload extensions by moving into the runtime instead of storing under the
|
|
|
|
# user's profile directory.
|
2019-10-23 18:21:03 +01:00
|
|
|
mkdir -p "$TBB_IN_STORE/browser/extensions"
|
2017-10-20 14:24:20 +01:00
|
|
|
mv "$TBB_IN_STORE/TorBrowser/Data/Browser/profile.default/extensions/"* \
|
|
|
|
"$TBB_IN_STORE/browser/extensions"
|
|
|
|
|
2017-03-26 13:51:08 +01:00
|
|
|
# Hard-code paths to geoip data files. TBB resolves the geoip files
|
|
|
|
# relative to torrc-defaults_path but if we do not hard-code them
|
|
|
|
# here, these paths end up being written to the torrc in the user's
|
|
|
|
# state dir.
|
2017-03-25 14:59:13 +00:00
|
|
|
cat >>TorBrowser/Data/Tor/torrc-defaults <<EOF
|
|
|
|
GeoIPFile $TBB_IN_STORE/TorBrowser/Data/Tor/geoip
|
|
|
|
GeoIPv6File $TBB_IN_STORE/TorBrowser/Data/Tor/geoip6
|
|
|
|
EOF
|
|
|
|
|
2019-09-24 09:28:37 +01:00
|
|
|
WRAPPER_LD_PRELOAD=${optionalString useHardenedMalloc
|
|
|
|
"${graphene-hardened-malloc}/lib/libhardened_malloc.so"}
|
|
|
|
|
2017-08-20 01:13:22 +01:00
|
|
|
WRAPPER_XDG_DATA_DIRS=${concatMapStringsSep ":" (x: "${x}/share") [
|
2019-02-13 21:47:50 +00:00
|
|
|
gnome3.adwaita-icon-theme
|
2018-02-25 02:23:58 +00:00
|
|
|
shared-mime-info
|
2017-08-20 01:13:22 +01:00
|
|
|
]}
|
2018-09-13 16:37:57 +01:00
|
|
|
WRAPPER_XDG_DATA_DIRS+=":"${concatMapStringsSep ":" (x: "${x}/share/gsettings-schemas/${x.name}") [
|
|
|
|
glib
|
|
|
|
gsettings-desktop-schemas
|
|
|
|
gtk3
|
|
|
|
]};
|
2017-08-20 01:13:22 +01:00
|
|
|
|
2017-03-25 14:59:13 +00:00
|
|
|
# Generate wrapper
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cat > "$out/bin/tor-browser" << EOF
|
2018-09-13 16:41:56 +01:00
|
|
|
#! ${runtimeShell}
|
2017-03-25 14:59:13 +00:00
|
|
|
set -o errexit -o nounset
|
|
|
|
|
2017-08-20 01:13:22 +01:00
|
|
|
PATH=${makeBinPath [ coreutils ]}
|
|
|
|
export LC_ALL=C
|
|
|
|
export LOCALE_ARCHIVE=${glibcLocales}/lib/locale/locale-archive
|
|
|
|
|
2017-03-25 14:59:13 +00:00
|
|
|
# Enter local state directory.
|
|
|
|
REAL_HOME=\$HOME
|
|
|
|
TBB_HOME=\''${TBB_HOME:-''${XDG_DATA_HOME:-\$REAL_HOME/.local/share}/tor-browser}
|
|
|
|
HOME=\$TBB_HOME
|
|
|
|
|
|
|
|
mkdir -p "\$HOME"
|
|
|
|
cd "\$HOME"
|
|
|
|
|
|
|
|
# Initialize empty TBB local state directory hierarchy. We
|
|
|
|
# intentionally mirror the layout that TBB would see if executed from
|
|
|
|
# the unpacked bundle dir.
|
|
|
|
mkdir -p "\$HOME/TorBrowser" "\$HOME/TorBrowser/Data"
|
|
|
|
|
|
|
|
# Initialize the Tor data directory.
|
|
|
|
mkdir -p "\$HOME/TorBrowser/Data/Tor"
|
|
|
|
|
2017-07-04 14:09:39 +01:00
|
|
|
# TBB will fail if ownership is too permissive
|
|
|
|
chmod 0700 "\$HOME/TorBrowser/Data/Tor"
|
|
|
|
|
2017-03-25 14:59:13 +00:00
|
|
|
# Initialize the browser profile state. Note that the only data
|
|
|
|
# copied from the Store payload is the initial bookmark file, which is
|
|
|
|
# never updated once created. All other files under user's profile
|
|
|
|
# dir are generated by TBB.
|
|
|
|
mkdir -p "\$HOME/TorBrowser/Data/Browser/profile.default"
|
|
|
|
cp -u --no-preserve=mode,owner "$TBB_IN_STORE/TorBrowser/Data/Browser/profile.default/bookmarks.html" \
|
|
|
|
"\$HOME/TorBrowser/Data/Browser/profile.default/bookmarks.html"
|
|
|
|
|
|
|
|
# Clear out some files that tend to capture store references but are
|
|
|
|
# easily generated by firefox at startup.
|
2019-05-07 09:53:14 +01:00
|
|
|
rm -f "\$HOME/TorBrowser/Data/Browser/profile.default"/{addonStartup.json.lz4,compatibility.ini,extensions.ini,extensions.json}
|
|
|
|
rm -f "\$HOME/TorBrowser/Data/Browser/profile.default"/startupCache/*
|
2017-03-25 14:59:13 +00:00
|
|
|
|
2019-04-17 15:25:49 +01:00
|
|
|
# XDG
|
|
|
|
: "\''${XDG_RUNTIME_DIR:=/run/user/\$(id -u)}"
|
|
|
|
: "\''${XDG_CONFIG_HOME:=\$REAL_HOME/.config}"
|
|
|
|
|
2017-03-25 14:59:13 +00:00
|
|
|
${optionalString pulseaudioSupport ''
|
|
|
|
# Figure out some envvars for pulseaudio
|
|
|
|
: "\''${PULSE_SERVER:=\$XDG_RUNTIME_DIR/pulse/native}"
|
|
|
|
: "\''${PULSE_COOKIE:=\$XDG_CONFIG_HOME/pulse/cookie}"
|
|
|
|
''}
|
|
|
|
|
|
|
|
# Font cache files capture store paths; clear them out on the off
|
|
|
|
# chance that TBB would continue using old font files.
|
|
|
|
rm -rf "\$HOME/.cache/fontconfig"
|
|
|
|
|
|
|
|
# Lift-off
|
|
|
|
#
|
|
|
|
# XAUTHORITY and DISPLAY are required for TBB to work at all.
|
|
|
|
#
|
|
|
|
# DBUS_SESSION_BUS_ADDRESS is inherited to avoid auto-launch; to
|
|
|
|
# prevent that, set it to an empty/invalid value prior to running
|
|
|
|
# tor-browser.
|
|
|
|
#
|
|
|
|
# PULSE_SERVER is necessary for audio playback.
|
|
|
|
#
|
|
|
|
# Setting FONTCONFIG_FILE is required to make fontconfig read the TBB
|
|
|
|
# fonts.conf; upstream uses FONTCONFIG_PATH, but FC_DEBUG=1024
|
|
|
|
# indicates the system fonts.conf being used instead.
|
2017-08-20 01:13:22 +01:00
|
|
|
#
|
|
|
|
# XDG_DATA_DIRS is set to prevent searching system dirs (looking for .desktop & icons)
|
2017-03-25 14:59:13 +00:00
|
|
|
exec env -i \
|
2019-09-24 09:28:37 +01:00
|
|
|
LD_PRELOAD=$WRAPPER_LD_PRELOAD \
|
|
|
|
\
|
2017-08-20 01:13:22 +01:00
|
|
|
TZ=":" \
|
|
|
|
TZDIR="\''${TZDIR:-}" \
|
|
|
|
LOCALE_ARCHIVE="\$LOCALE_ARCHIVE" \
|
|
|
|
\
|
|
|
|
TMPDIR="\''${TMPDIR:-/tmp}" \
|
2017-03-25 14:59:13 +00:00
|
|
|
HOME="\$HOME" \
|
2019-04-17 15:25:49 +01:00
|
|
|
XAUTHORITY="\''${XAUTHORITY:-\$HOME/.Xauthority}" \
|
2017-03-25 14:59:13 +00:00
|
|
|
DISPLAY="\$DISPLAY" \
|
2019-04-17 15:25:49 +01:00
|
|
|
DBUS_SESSION_BUS_ADDRESS="\''${DBUS_SESSION_BUS_ADDRESS:-unix:path=\$XDG_RUNTIME_DIR/bus}" \\
|
2017-03-25 14:59:13 +00:00
|
|
|
\
|
2017-08-20 01:13:22 +01:00
|
|
|
XDG_DATA_HOME="\$HOME/.local/share" \
|
|
|
|
XDG_DATA_DIRS="$WRAPPER_XDG_DATA_DIRS" \
|
|
|
|
\
|
2017-03-25 14:59:13 +00:00
|
|
|
PULSE_SERVER="\''${PULSE_SERVER:-}" \
|
|
|
|
PULSE_COOKIE="\''${PULSE_COOKIE:-}" \
|
2017-09-04 14:39:53 +01:00
|
|
|
\
|
2017-09-25 14:37:56 +01:00
|
|
|
APULSE_PLAYBACK_DEVICE="\''${APULSE_PLAYBACK_DEVICE:-plug:dmix}" \
|
2017-09-23 17:25:42 +01:00
|
|
|
\
|
2017-04-16 14:14:56 +01:00
|
|
|
TOR_SKIP_LAUNCH="\''${TOR_SKIP_LAUNCH:-}" \
|
2017-09-04 14:39:53 +01:00
|
|
|
TOR_CONTROL_PORT="\''${TOR_CONTROL_PORT:-}" \
|
|
|
|
TOR_SOCKS_PORT="\''${TOR_SOCKS_PORT:-}" \
|
2017-03-25 14:59:13 +00:00
|
|
|
\
|
|
|
|
FONTCONFIG_FILE="$FONTCONFIG_FILE" \
|
|
|
|
\
|
|
|
|
LD_LIBRARY_PATH="$libPath" \
|
|
|
|
\
|
|
|
|
"$TBB_IN_STORE/firefox" \
|
|
|
|
--class "Tor Browser" \
|
|
|
|
-no-remote \
|
|
|
|
-profile "\$HOME/TorBrowser/Data/Browser/profile.default" \
|
|
|
|
"\''${@}"
|
|
|
|
EOF
|
|
|
|
chmod +x $out/bin/tor-browser
|
|
|
|
|
|
|
|
# Easier access to docs
|
|
|
|
mkdir -p $out/share/doc
|
|
|
|
ln -s $TBB_IN_STORE/TorBrowser/Docs $out/share/doc/tor-browser
|
|
|
|
|
|
|
|
# Install .desktop item
|
|
|
|
mkdir -p $out/share/applications
|
|
|
|
cp $desktopItem/share/applications"/"* $out/share/applications
|
2017-03-26 15:20:08 +01:00
|
|
|
sed -i $out/share/applications/torbrowser.desktop \
|
2017-08-20 11:30:02 +01:00
|
|
|
-e "s,Exec=.*,Exec=$out/bin/tor-browser," \
|
2019-10-16 21:48:42 +01:00
|
|
|
-e "s,Icon=.*,Icon=tor-browser,"
|
|
|
|
for i in 16 32 48 64 128; do
|
|
|
|
mkdir -p $out/share/icons/hicolor/''${i}x''${i}/apps/
|
|
|
|
ln -s $out/share/tor-browser/browser/chrome/icons/default/default$i.png $out/share/icons/hicolor/''${i}x''${i}/apps/tor-browser.png
|
|
|
|
done
|
2017-03-25 14:59:13 +00:00
|
|
|
|
|
|
|
# Check installed apps
|
|
|
|
echo "Checking bundled Tor ..."
|
|
|
|
LD_LIBRARY_PATH=$libPath $TBB_IN_STORE/TorBrowser/Tor/tor --version >/dev/null
|
|
|
|
|
|
|
|
echo "Checking tor-browser wrapper ..."
|
|
|
|
DISPLAY="" XAUTHORITY="" DBUS_SESSION_BUS_ADDRESS="" TBB_HOME=$(mktemp -d) \
|
|
|
|
$out/bin/tor-browser --version >/dev/null
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
2018-08-31 03:41:29 +01:00
|
|
|
description = "Tor Browser Bundle built by torproject.org";
|
2020-01-10 17:08:28 +00:00
|
|
|
longDescription = ''
|
|
|
|
Tor Browser Bundle is a bundle of the Tor daemon, Tor Browser (heavily patched version of
|
|
|
|
Firefox), several essential extensions for Tor Browser, and some tools that glue those
|
|
|
|
together with a convenient UI.
|
|
|
|
|
|
|
|
`tor-browser-bundle-bin` package is the official version built by torproject.org patched with
|
|
|
|
`patchelf` to work under nix and with bundled scripts adapted to the read-only nature of
|
|
|
|
the `/nix/store`.
|
|
|
|
'';
|
2019-05-07 08:39:33 +01:00
|
|
|
homepage = "https://www.torproject.org/";
|
2020-06-03 06:46:00 +01:00
|
|
|
changelog = "https://gitweb.torproject.org/builders/tor-browser-build.git/plain/projects/tor-browser/Bundle-Data/Docs/ChangeLog.txt?h=maint-${version}";
|
2017-03-25 14:59:13 +00:00
|
|
|
platforms = attrNames srcs;
|
2019-12-13 19:20:52 +00:00
|
|
|
maintainers = with maintainers; [ offline matejc doublec thoughtpolice joachifm hax404 cap ];
|
2017-03-25 14:59:13 +00:00
|
|
|
hydraPlatforms = [];
|
|
|
|
# MPL2.0+, GPL+, &c. While it's not entirely clear whether
|
|
|
|
# the compound is "libre" in a strict sense (some components place certain
|
|
|
|
# restrictions on redistribution), it's free enough for our purposes.
|
|
|
|
license = licenses.free;
|
|
|
|
};
|
|
|
|
}
|