git.iko.soy/typeable/nixpkgs
on master help sign in
firefoxPackages: tor-browser: init at 6.5.2
commit00a0b8a5741eb78391932a26dad0881bc01cef30 authorSLNOS <anonymous@wired> dateSat 1 Apr 2017, 00:00 (10 years ago) parent2f35ab5
3 files changed+100−12
pkgs/applications/networking/browsers/firefox/common.nix+38−11 pkgs/applications/networking/browsers/firefox/packages.nix+61−1 pkgs/top-level/all-packages.nix+1
pkgs/applications/networking/browsers/firefox/common.nix+38−11
@@ -1,5 +1,6 @@
11{ pname, version, updateScript ? null
2−, src, patches ? [], meta }:
2+, src, patches ? [], overrides ? {}, meta
3+, isTorBrowserLike ? false }:
34
45{ lib, stdenv, pkgconfig, pango, perl, python, zip, libIDL
56, libjpeg, zlib, dbus, dbus_glib, bzip2, xorg
@@ -22,12 +23,13 @@
2223
2324## privacy-related options
2425
25−, privacySupport ? false
26+, privacySupport ? isTorBrowserLike
2627
2728# WARNING: NEVER set any of the options below to `true` by default.
2829# Set to `privacySupport` or `false`.
2930
3031, webrtcSupport ? !privacySupport
32+, loopSupport ? !privacySupport || !isTorBrowserLike
3133, geolocationSupport ? !privacySupport
3234, googleAPISupport ? geolocationSupport
3335, crashreporterSupport ? false
@@ -37,21 +39,22 @@
3739
3840## other
3941
40−# If you want the resulting program to call itself "Firefox" instead
41−# of "Nightly" or whatever, enable this option. However, those
42−# binaries may not be distributed without permission from the
43−# Mozilla Foundation, see
42+# If you want the resulting program to call itself
43+# "Firefox"/"Torbrowser" instead of "Nightly" or whatever, enable this
44+# option. However, in Firefox's case, those binaries may not be
45+# distributed without permission from the Mozilla Foundation, see
4446# http://www.mozilla.org/foundation/trademarks/.
4547, enableOfficialBranding ? false
4648}:
4749
4850assert stdenv.cc ? libc && stdenv.cc.libc != null;
51+assert !isTorBrowserLike -> loopSupport; # can't be disabled on firefox :(
4952
5053let
5154 flag = tf: x: [(if tf then "--enable-${x}" else "--disable-${x}")];
5255in
5356
54−stdenv.mkDerivation rec {
57+stdenv.mkDerivation (rec {
5558 name = "${pname}-unwrapped-${version}";
5659
5760 inherit src patches meta;
@@ -60,12 +63,14 @@ stdenv.mkDerivation rec {
6063 gtk2 perl zip libIDL libjpeg zlib bzip2
6164 dbus dbus_glib pango freetype fontconfig xorg.libXi
6265 xorg.libX11 xorg.libXrender xorg.libXft xorg.libXt file
63− nss nspr libnotify xorg.pixman yasm mesa
66+ nspr libnotify xorg.pixman yasm mesa
6467 xorg.libXScrnSaver xorg.scrnsaverproto
6568 xorg.libXext xorg.xextproto sqlite unzip makeWrapper
6669 hunspell libevent libstartup_notification libvpx /* cairo */
6770 icu libpng jemalloc
6871 ]
72+ ++ lib.optionals (!isTorBrowserLike) [ nss ]
73+
6974 ++ lib.optional alsaSupport alsaLib
7075 ++ lib.optional pulseaudioSupport libpulseaudio # only headers are needed
7176 ++ lib.optionals ffmpegSupport [ gstreamer gst-plugins-base ]
@@ -98,8 +103,6 @@ stdenv.mkDerivation rec {
98103 "--with-system-jpeg"
99104 "--with-system-zlib"
100105 "--with-system-bz2"
101− "--with-system-nspr"
102− "--with-system-nss"
103106 "--with-system-libevent"
104107 "--with-system-libvpx"
105108 "--with-system-png" # needs APNG support
@@ -119,11 +122,33 @@ stdenv.mkDerivation rec {
119122 "--disable-gconf"
120123 "--enable-default-toolkit=cairo-gtk${if gtk3Support then "3" else "2"}"
121124 ]
125+
126+ # TorBrowser patches these
127+ ++ lib.optionals (!isTorBrowserLike) [
128+ "--with-system-nss"
129+ "--with-system-nspr"
130+ ]
131+
132+ # and wants these
133+ ++ lib.optionals isTorBrowserLike [
134+ "--with-tor-browser-version=${version}"
135+ "--enable-signmar"
136+ "--enable-verify-mar"
137+
138+ # We opt out of TorBrowser's nspr because that patch is useless on
139+ # anything but Windows and produces zero fingerprinting
140+ # possibilities on other platforms.
141+ # Lets save some space instead.
142+ "--with-system-nspr"
143+ ]
144+
122145 ++ flag alsaSupport "alsa"
123146 ++ flag pulseaudioSupport "pulseaudio"
124147 ++ flag ffmpegSupport "ffmpeg"
125148 ++ lib.optional (!ffmpegSupport) "--disable-gstreamer"
126149 ++ flag webrtcSupport "webrtc"
150+ ++ lib.optionals isTorBrowserLike
151+ (flag loopSupport "loop")
127152 ++ flag geolocationSupport "mozril-geoloc"
128153 ++ lib.optional googleAPISupport "--with-google-api-keyfile=ga"
129154 ++ flag crashreporterSupport "crashreporter"
@@ -171,8 +196,10 @@ stdenv.mkDerivation rec {
171196 browserName = "firefox";
172197 inherit version updateScript;
173198 isFirefox3Like = true;
199+ inherit isTorBrowserLike;
174200 gtk = gtk2;
175201 inherit nspr;
176202 inherit ffmpegSupport;
177203 };
178−}
204+
205+} // overrides)
pkgs/applications/networking/browsers/firefox/packages.nix+61−1
@@ -1,4 +1,4 @@
1−{ lib, callPackage, fetchurl }:
1+{ lib, callPackage, fetchurl, fetchFromGitHub }:
22
33let common = opts: callPackage (import ./common.nix opts); in
44
@@ -40,4 +40,64 @@ rec {
4040 };
4141 } {};
4242
43+ tor-browser = common rec {
44+ pname = "tor-browser";
45+ version = "6.5.2";
46+ isTorBrowserLike = true;
47+
48+ # FIXME: fetchFromGitHub is not ideal, unpacked source is >900Mb
49+ src = fetchFromGitHub {
50+ owner = "SLNOS";
51+ repo = "tor-browser";
52+ rev = "tor-browser-45.8.0esr-6.5-2";
53+ sha256 = "0vbcp1qlxjlph0dqibylsyvb8iah3lnzdxc56hllpvbn51vrp39j";
54+ };
55+
56+ overrides = {
57+ unpackPhase = ''
58+ # fetchFromGitHub produces ro sources, root dir gets a name that
59+ # is too long for shebangs. fixing
60+ cp -a $src .
61+ mv *-src tor-browser
62+ chmod -R +w tor-browser
63+ cd tor-browser
64+
65+ # set times for xpi archives
66+ find . -exec touch -d'2010-01-01 00:00' {} \;
67+ '';
68+ };
69+
70+ meta = {
71+ description = "A web browser built from TorBrowser source tree";
72+ longDescription = ''
73+ This is a version of TorBrowser with bundle-related patches
74+ reverted.
75+
76+ I.e. it's a variant of Firefox with less fingerprinting and
77+ some isolation features you can't get with any extensions.
78+
79+ Or, alternatively, a variant of TorBrowser that works like any
80+ other UNIX program and doesn't expect you to run it from a
81+ bundle.
82+
83+ It will use your default Firefox profile if you're not careful
84+ even! Be careful!
85+
86+ It will clash with firefox binary if you install both. But its
87+ not a problem since you should run browsers in separate
88+ users/VMs anyway.
89+
90+ Create new profile by starting it as
91+
92+ $ firefox -ProfileManager
93+
94+ and then configure it to use your tor instance.
95+ '';
96+ homepage = https://www.torproject.org/projects/torbrowser.html;
97+ platforms = lib.platforms.linux;
98+ };
99+ } {
100+ ffmpegSupport = false;
101+ };
102+
43103}
pkgs/top-level/all-packages.nix+1
@@ -13787,6 +13787,7 @@ with pkgs;
1378713787
1378813788 firefox-unwrapped = firefoxPackages.firefox;
1378913789 firefox-esr-unwrapped = firefoxPackages.firefox-esr;
13790+ tor-browser-unwrapped = firefoxPackages.tor-browser;
1379013791
1379113792 firefox = wrapFirefox firefox-unwrapped { };
1379213793 firefox-esr = wrapFirefox firefox-esr-unwrapped { };