@@ -0,0 +1,62 @@
1+{ stdenv
2+, fetchFromGitHub
3+, pkgconfig
4+, autoreconfHook
5+, libtool
6+, libpcap
7+
8+# Optional Dependencies
9+, zlib ? null
10+, withJansson ? true, jansson ? null
11+, withNflog ? true, libnetfilter_log ? null
12+, withSQLite ? true, sqlite ? null
13+, withPgSQL ? true, postgresql ? null
14+, withMysql ? true, libmysqlclient ? null }:
15+
16+assert withJansson -> jansson != null;
17+assert withNflog -> libnetfilter_log != null;
18+assert withSQLite -> sqlite != null;
19+assert withPgSQL -> postgresql != null;
20+assert withMysql -> libmysqlclient != null;
21+
22+let inherit (stdenv.lib) optional; in
23+
24+stdenv.mkDerivation rec {
25+ version = "1.7.3";
26+ pname = "pmacct";
27+
28+ src = fetchFromGitHub {
29+ owner = "pmacct";
30+ repo = pname;
31+ rev = "v${version}";
32+ sha256 = "0j5qmkya67q7jvaddcj00blmaac37bkir1zb3m1xmm95gm5lf2p5";
33+ };
34+
35+ nativeBuildInputs = [ autoreconfHook pkgconfig libtool ];
36+ buildInputs = [ libpcap ]
37+ ++ optional withJansson jansson
38+ ++ optional withNflog libnetfilter_log
39+ ++ optional withSQLite sqlite
40+ ++ optional withPgSQL postgresql
41+ ++ optional withMysql [ libmysqlclient zlib ];
42+
43+ configureFlags = [
44+ "--with-pcap-includes=${libpcap}/include"
45+ ] ++ optional withJansson "--enable-jansson"
46+ ++ optional withNflog "--enable-nflog"
47+ ++ optional withSQLite "--enable-sqlite3"
48+ ++ optional withPgSQL "--enable-pgsql"
49+ ++ optional withMysql "--enable-mysql";
50+
51+ meta = with stdenv.lib; {
52+ description = "pmacct is a small set of multi-purpose passive network monitoring tools";
53+ longDescription = ''
54+ pmacct is a small set of multi-purpose passive network monitoring tools
55+ [NetFlow IPFIX sFlow libpcap BGP BMP RPKI IGP Streaming Telemetry]
56+ '';
57+ homepage = "http://www.pmacct.net/";
58+ license = licenses.gpl2;
59+ maintainers = with maintainers; [ "0x4A6F" ];
60+ platforms = platforms.unix;
61+ };
62+}