1{
2 lib,
3 stdenv,
4 fetchurl,
5
6 # build-time deps
7 libtool,
8 makeWrapper,
9 meson,
10 ninja,
11 pkg-config,
12
13 # runtime deps
14 adns,
15 bashNonInteractive,
16 curl,
17 gettext,
18 gmp,
19 gnutls,
20 jansson,
21 libextractor,
22 libgcrypt,
23 libgnurl,
24 libidn,
25 libmicrohttpd,
26 libogg,
27 libopus,
28 libpulseaudio,
29 libsodium,
30 libunistring,
31 libxml2,
32 ncurses,
33 sqlite,
34 zlib,
35
36 postgresqlSupport ? true,
37 libpq,
38}:
39
40stdenv.mkDerivation (finalAttrs: {
41 pname = "gnunet";
42 version = "0.24.3";
43
44 src = fetchurl {
45 url = "mirror://gnu/gnunet/gnunet-${finalAttrs.version}.tar.gz";
46 hash = "sha256-WwaJew6ESJu7Q4J47HPkNiRCsuBaY+QAI+wdDMzGxXY=";
47 };
48
49 enableParallelBuilding = true;
50
51 nativeBuildInputs = [
52 gettext # msgfmt
53 makeWrapper
54 meson
55 ninja
56 pkg-config
57 ];
58
59 buildInputs = [
60 adns
61 bashNonInteractive
62 curl
63 gmp
64 gnutls
65 jansson
66 libextractor
67 libgcrypt
68 libgnurl
69 libidn
70 libmicrohttpd
71 libogg
72 libopus
73 libpulseaudio
74 libsodium
75 libtool
76 libunistring
77 libxml2
78 ncurses
79 sqlite
80 zlib
81 ]
82 ++ lib.optional postgresqlSupport libpq;
83
84 strictDeps = true;
85
86 preConfigure = ''
87 # Brute force: since nix-worker chroots don't provide
88 # /etc/{resolv.conf,hosts}, replace all references to `localhost'
89 # by their IPv4 equivalent.
90 find . \( -name \*.c -or -name \*.conf \) | \
91 xargs sed -i -e 's|\<localhost\>|127.0.0.1|g'
92
93 # Make sure the tests don't rely on `/tmp', for the sake of chroot
94 # builds.
95 find . \( -iname \*test\*.c -or -name \*.conf \) | \
96 xargs sed -i -e "s|/tmp|$TMPDIR|g"
97 '';
98
99 # unfortunately, there's still a few failures with impure tests
100 doCheck = false;
101 checkPhase = ''
102 export GNUNET_PREFIX="$out"
103 export PATH="$out/bin:$PATH"
104 make -k check
105 '';
106
107 meta = {
108 description = "GNU's decentralized anonymous and censorship-resistant P2P framework";
109
110 longDescription = ''
111 GNUnet is a framework for secure peer-to-peer networking that
112 does not use any centralized or otherwise trusted services. A
113 first service implemented on top of the networking layer
114 allows anonymous censorship-resistant file-sharing. Anonymity
115 is provided by making messages originating from a peer
116 indistinguishable from messages that the peer is routing. All
117 peers act as routers and use link-encrypted connections with
118 stable bandwidth utilization to communicate with each other.
119 GNUnet uses a simple, excess-based economic model to allocate
120 resources. Peers in GNUnet monitor each others behavior with
121 respect to resource usage; peers that contribute to the
122 network are rewarded with better service.
123 '';
124
125 homepage = "https://gnunet.org/";
126 license = lib.licenses.agpl3Plus;
127 maintainers = with lib.maintainers; [ pstn ];
128 teams = with lib.teams; [ ngi ];
129 platforms = lib.platforms.unix;
130 changelog = "https://git.gnunet.org/gnunet.git/tree/ChangeLog?h=v${finalAttrs.version}";
131 # meson: "Can not run test applications in this cross environment." (for dane_verify_crt_raw)
132 broken = !stdenv.buildPlatform.canExecute stdenv.hostPlatform;
133 };
134})