git.iko.soy/typeable/nixpkgs
on master help sign in
firefoxPackages: tor-browser: init at 6.5.2
00a0b8aSLNOS
pkgs/applications/networking/browsers/firefox/common.nix+38−11
@@ -1,5 +1,6 @@
1{ pname, version, updateScript ? null
1{ pname, version, updateScript ? null
2−, src, patches ? [], meta }:
2+, src, patches ? [], overrides ? {}, meta
3+, isTorBrowserLike ? false }:
3
4
4{ lib, stdenv, pkgconfig, pango, perl, python, zip, libIDL
5{ lib, stdenv, pkgconfig, pango, perl, python, zip, libIDL
5, libjpeg, zlib, dbus, dbus_glib, bzip2, xorg
6, libjpeg, zlib, dbus, dbus_glib, bzip2, xorg
@@ -22,12 +23,13 @@
22
23
23## privacy-related options
24## privacy-related options
24
25
25−, privacySupport ? false
26+, privacySupport ? isTorBrowserLike
26
27
27# WARNING: NEVER set any of the options below to `true` by default.
28# WARNING: NEVER set any of the options below to `true` by default.
28# Set to `privacySupport` or `false`.
29# Set to `privacySupport` or `false`.
29
30
30, webrtcSupport ? !privacySupport
31, webrtcSupport ? !privacySupport
32+, loopSupport ? !privacySupport || !isTorBrowserLike
31, geolocationSupport ? !privacySupport
33, geolocationSupport ? !privacySupport
32, googleAPISupport ? geolocationSupport
34, googleAPISupport ? geolocationSupport
33, crashreporterSupport ? false
35, crashreporterSupport ? false
@@ -37,21 +39,22 @@
37
39
38## other
40## other
39
41
40−# If you want the resulting program to call itself "Firefox" instead
42+# If you want the resulting program to call itself
41−# of "Nightly" or whatever, enable this option. However, those
43+# "Firefox"/"Torbrowser" instead of "Nightly" or whatever, enable this
44+# option. However, in Firefox's case, those binaries may not be
42−# binaries may not be distributed without permission from the
45+# distributed without permission from the Mozilla Foundation, see
43−# Mozilla Foundation, see
44# http://www.mozilla.org/foundation/trademarks/.
46# http://www.mozilla.org/foundation/trademarks/.
45, enableOfficialBranding ? false
47, enableOfficialBranding ? false
46}:
48}:
47
49
48assert stdenv.cc ? libc && stdenv.cc.libc != null;
50assert stdenv.cc ? libc && stdenv.cc.libc != null;
51+assert !isTorBrowserLike -> loopSupport; # can't be disabled on firefox :(
49
52
50let
53let
51 flag = tf: x: [(if tf then "--enable-${x}" else "--disable-${x}")];
54 flag = tf: x: [(if tf then "--enable-${x}" else "--disable-${x}")];
52in
55in
53
56
54−stdenv.mkDerivation rec {
57+stdenv.mkDerivation (rec {
55 name = "${pname}-unwrapped-${version}";
58 name = "${pname}-unwrapped-${version}";
56
59
57 inherit src patches meta;
60 inherit src patches meta;
@@ -60,12 +63,14 @@ stdenv.mkDerivation rec {
60 gtk2 perl zip libIDL libjpeg zlib bzip2
63 gtk2 perl zip libIDL libjpeg zlib bzip2
61 dbus dbus_glib pango freetype fontconfig xorg.libXi
64 dbus dbus_glib pango freetype fontconfig xorg.libXi
62 xorg.libX11 xorg.libXrender xorg.libXft xorg.libXt file
65 xorg.libX11 xorg.libXrender xorg.libXft xorg.libXt file
63− nss nspr libnotify xorg.pixman yasm mesa
66+ nspr libnotify xorg.pixman yasm mesa
64 xorg.libXScrnSaver xorg.scrnsaverproto
67 xorg.libXScrnSaver xorg.scrnsaverproto
65 xorg.libXext xorg.xextproto sqlite unzip makeWrapper
68 xorg.libXext xorg.xextproto sqlite unzip makeWrapper
66 hunspell libevent libstartup_notification libvpx /* cairo */
69 hunspell libevent libstartup_notification libvpx /* cairo */
67 icu libpng jemalloc
70 icu libpng jemalloc
68 ]
71 ]
72+ ++ lib.optionals (!isTorBrowserLike) [ nss ]
73+
69 ++ lib.optional alsaSupport alsaLib
74 ++ lib.optional alsaSupport alsaLib
70 ++ lib.optional pulseaudioSupport libpulseaudio # only headers are needed
75 ++ lib.optional pulseaudioSupport libpulseaudio # only headers are needed
71 ++ lib.optionals ffmpegSupport [ gstreamer gst-plugins-base ]
76 ++ lib.optionals ffmpegSupport [ gstreamer gst-plugins-base ]
@@ -98,8 +103,6 @@ stdenv.mkDerivation rec {
98 "--with-system-jpeg"
103 "--with-system-jpeg"
99 "--with-system-zlib"
104 "--with-system-zlib"
100 "--with-system-bz2"
105 "--with-system-bz2"
101− "--with-system-nspr"
102− "--with-system-nss"
103 "--with-system-libevent"
106 "--with-system-libevent"
104 "--with-system-libvpx"
107 "--with-system-libvpx"
105 "--with-system-png" # needs APNG support
108 "--with-system-png" # needs APNG support
@@ -119,11 +122,33 @@ stdenv.mkDerivation rec {
119 "--disable-gconf"
122 "--disable-gconf"
120 "--enable-default-toolkit=cairo-gtk${if gtk3Support then "3" else "2"}"
123 "--enable-default-toolkit=cairo-gtk${if gtk3Support then "3" else "2"}"
121 ]
124 ]
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+
122 ++ flag alsaSupport "alsa"
145 ++ flag alsaSupport "alsa"
123 ++ flag pulseaudioSupport "pulseaudio"
146 ++ flag pulseaudioSupport "pulseaudio"
124 ++ flag ffmpegSupport "ffmpeg"
147 ++ flag ffmpegSupport "ffmpeg"
125 ++ lib.optional (!ffmpegSupport) "--disable-gstreamer"
148 ++ lib.optional (!ffmpegSupport) "--disable-gstreamer"
126 ++ flag webrtcSupport "webrtc"
149 ++ flag webrtcSupport "webrtc"
150+ ++ lib.optionals isTorBrowserLike
151+ (flag loopSupport "loop")
127 ++ flag geolocationSupport "mozril-geoloc"
152 ++ flag geolocationSupport "mozril-geoloc"
128 ++ lib.optional googleAPISupport "--with-google-api-keyfile=ga"
153 ++ lib.optional googleAPISupport "--with-google-api-keyfile=ga"
129 ++ flag crashreporterSupport "crashreporter"
154 ++ flag crashreporterSupport "crashreporter"
@@ -171,8 +196,10 @@ stdenv.mkDerivation rec {
171 browserName = "firefox";
196 browserName = "firefox";
172 inherit version updateScript;
197 inherit version updateScript;
173 isFirefox3Like = true;
198 isFirefox3Like = true;
199+ inherit isTorBrowserLike;
174 gtk = gtk2;
200 gtk = gtk2;
175 inherit nspr;
201 inherit nspr;
176 inherit ffmpegSupport;
202 inherit ffmpegSupport;
177 };
203 };
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 }:
2
2
3let common = opts: callPackage (import ./common.nix opts); in
3let common = opts: callPackage (import ./common.nix opts); in
4
4
@@ -40,4 +40,64 @@ rec {
40 };
40 };
41 } {};
41 } {};
42
42
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+
43}
103}
pkgs/top-level/all-packages.nix+1
@@ -13787,6 +13787,7 @@ with pkgs;
13787
13787
13788 firefox-unwrapped = firefoxPackages.firefox;
13788 firefox-unwrapped = firefoxPackages.firefox;
13789 firefox-esr-unwrapped = firefoxPackages.firefox-esr;
13789 firefox-esr-unwrapped = firefoxPackages.firefox-esr;
13790+ tor-browser-unwrapped = firefoxPackages.tor-browser;
13790
13791
13791 firefox = wrapFirefox firefox-unwrapped { };
13792 firefox = wrapFirefox firefox-unwrapped { };
13792 firefox-esr = wrapFirefox firefox-esr-unwrapped { };
13793 firefox-esr = wrapFirefox firefox-esr-unwrapped { };