nixpkgs-gnunet/pkgs/gnunet/default.nix

107 lines
3.6 KiB
Nix
Raw Normal View History

2018-11-14 18:02:43 +01:00
{ stdenv, fetchgit, libtool, pkgconfig, autoconf, automake, gettext, libgcrypt
, libidn2, zlib, libunistring, glpk, miniupnpc, libextractor, jansson, libgnurl
, sqlite, postgresql, mariadb, libmicrohttpd, iptables, nettools, gnutls
2019-06-28 17:43:56 +02:00
, unbound, coreutils, file, python3, texinfo, procps, iproute
, withVerbose ? false
2018-11-14 18:02:43 +01:00
, withDocumentation ? false
, withSqlite ? true
, withPostgres ? false
, withMariadb ? false}:
with stdenv.lib;
let
2020-04-18 20:35:26 +02:00
rev = "0c053ecbf57987b2f03f661bc09b9fabf8aae63f";
2018-11-14 18:02:43 +01:00
in
stdenv.mkDerivation rec {
name = "gnunet-${rev}";
2019-06-29 14:02:19 +02:00
src = fetchgit {
url = https://git.gnunet.org/gnunet.git;
inherit rev;
2020-04-18 20:35:26 +02:00
sha256 = "1aihfywp64f6n8n962328dg9ww9bibmsf9p1kxsmg8zv4hzf2fq5";
fetchSubmodules = true;
2019-06-29 14:02:19 +02:00
};
2018-11-14 18:02:43 +01:00
phases = [
"unpackPhase" "preConfigure" "configurePhase" "buildPhase" "installPhase"
"checkPhase"
];
enableParallelBuilding = true;
#doCheck = true;
nativeBuildInputs = [
2019-06-28 17:43:56 +02:00
libtool pkgconfig autoconf automake gettext coreutils file python3
2018-11-14 18:02:43 +01:00
]
++ optional withDocumentation texinfo;
2019-06-28 17:43:56 +02:00
propagatedBuildInputs = [
2018-11-14 18:02:43 +01:00
libgcrypt libidn2 zlib libunistring glpk miniupnpc libextractor jansson
2019-06-28 17:43:56 +02:00
libgnurl libmicrohttpd iptables nettools gnutls unbound procps iproute
2018-11-14 18:02:43 +01:00
]
++ optional withSqlite sqlite
++ optional withPostgres postgresql
++ optional withMariadb mariadb;
configureFlags =
2019-06-28 17:43:56 +02:00
[ "--enable-logging=verbose" ]
2018-11-14 18:02:43 +01:00
++ optional (!withDocumentation) "--disable-documentation";
2019-06-28 17:43:56 +02:00
NIX_CFLAGS_COMPILE = "-g -Wall -O0";
2018-11-14 18:02:43 +01:00
preConfigure = ''
2019-06-28 17:43:56 +02:00
#substituteInPlace configure.ac --replace "/usr/sbin/iptables" "${iptables}/bin/iptables"
#substituteInPlace configure.ac --replace "/sbin/ifconfig" "ifconfig"
2018-11-14 18:02:43 +01:00
sh bootstrap
2019-06-28 17:43:56 +02:00
#substituteInPlace configure --replace "/usr/bin/file" "file"
#substituteInPlace configure --replace "/usr/bin/objformat" "objformat"
substituteInPlace src/dns/gnunet-helper-dns.c --replace '"/sbin/iptables"' '"${iptables}/bin/iptables"'
substituteInPlace src/dns/gnunet-helper-dns.c --replace '"/sbin/ip6tables"' '"${iptables}/bin/ip6tables"'
substituteInPlace src/dns/gnunet-helper-dns.c --replace '"/sbin/ip"' '"${iproute}/bin/ip"'
substituteInPlace src/dns/gnunet-helper-dns.c --replace '"/sbin/sysctl"' '"${procps}/bin/sysctl"'
'';
postInstall = ''
mv $out/lib/gnunet/nss/* $out/lib/
rmdir $out/lib/gnunet/nss
2018-11-14 18:02:43 +01:00
'';
/* FIXME: Tests must be run this way, but there are still a couple of
failures. */
2019-06-28 17:43:56 +02:00
checkPhase = ''
export GNUNET_PREFIX="$out"
export GNUNET_TMP="$TMPDIR"
export PATH="$out/bin:$PATH"
make -k check
'';
2018-11-14 18:02:43 +01:00
meta = with stdenv.lib; {
description = "GNUnet, GNU's decentralized anonymous and censorship-resistant P2P framework";
longDescription = ''
GNUnet is a framework for secure peer-to-peer networking that
does not use any centralized or otherwise trusted services. A
first service implemented on top of the networking layer
allows anonymous censorship-resistant file-sharing. Anonymity
is provided by making messages originating from a peer
indistinguishable from messages that the peer is routing. All
peers act as routers and use link-encrypted connections with
stable bandwidth utilization to communicate with each other.
GNUnet uses a simple, excess-based economic model to allocate
resources. Peers in GNUnet monitor each others behavior with
respect to resource usage; peers that contribute to the
network are rewarded with better service.
'';
homepage = https://gnunet.org/;
license = licenses.agpl3;
maintainers = with maintainers; [ ];
platforms = platforms.gnu ++ platforms.linux;
};
}