lol
1{ stdenv, fetchurl, pkgconfig, libevent, openssl, zlib, torsocks
2, libseccomp, systemd, libcap
3
4# for update.nix
5, writeScript
6, runCommand
7, common-updater-scripts
8, bash
9, coreutils
10, curl
11, gnugrep
12, gnupg
13, gnused
14, nix
15}:
16
17stdenv.mkDerivation rec {
18 name = "tor-0.3.2.10";
19
20 src = fetchurl {
21 url = "https://dist.torproject.org/${name}.tar.gz";
22 sha256 = "1vnb2wkcmm8rnz0fqi3k7arl60mpycs8rjn8hvbgv56g3p1pgpv0";
23 };
24
25 outputs = [ "out" "geoip" ];
26
27 enableParallelBuilding = true;
28
29 nativeBuildInputs = [ pkgconfig ];
30 buildInputs = [ libevent openssl zlib ] ++
31 stdenv.lib.optionals stdenv.isLinux [ libseccomp systemd libcap ];
32
33 NIX_CFLAGS_LINK = stdenv.lib.optionalString stdenv.cc.isGNU "-lgcc_s";
34
35 postPatch = ''
36 substituteInPlace contrib/client-tools/torify \
37 --replace 'pathfind torsocks' true \
38 --replace 'exec torsocks' 'exec ${torsocks}/bin/torsocks'
39 '';
40
41 postInstall = ''
42 mkdir -p $geoip/share/tor
43 mv $out/share/tor/geoip{,6} $geoip/share/tor
44 rm -rf $out/share/tor
45 '';
46
47 doCheck = true;
48
49 passthru.updateScript = import ./update.nix {
50 inherit (stdenv) lib;
51 inherit
52 writeScript
53 runCommand
54 common-updater-scripts
55 bash
56 coreutils
57 curl
58 gnupg
59 gnugrep
60 gnused
61 nix
62 ;
63 };
64
65 meta = with stdenv.lib; {
66 homepage = https://www.torproject.org/;
67 repositories.git = https://git.torproject.org/git/tor;
68 description = "Anonymizing overlay network";
69
70 longDescription = ''
71 Tor helps improve your privacy by bouncing your communications around a
72 network of relays run by volunteers all around the world: it makes it
73 harder for somebody watching your Internet connection to learn what sites
74 you visit, and makes it harder for the sites you visit to track you. Tor
75 works with many of your existing applications, including web browsers,
76 instant messaging clients, remote login, and other applications based on
77 the TCP protocol.
78 '';
79
80 license = licenses.bsd3;
81
82 maintainers = with maintainers;
83 [ phreedom doublec thoughtpolice joachifm ];
84 platforms = platforms.unix;
85 };
86}