1{ lib, stdenv, fetchurl, pkg-config, bison, flex
2, asciidoc, libxslt, findXMLCatalogs, docbook_xml_dtd_45, docbook_xsl
3, libmnl, libnftnl, libpcap
4, gmp, jansson, libedit
5, autoreconfHook
6, withDebugSymbols ? false
7, withPython ? false , python3
8, withXtables ? true , iptables
9}:
10
11stdenv.mkDerivation rec {
12 version = "1.0.5";
13 pname = "nftables";
14
15 src = fetchurl {
16 url = "https://netfilter.org/projects/nftables/files/${pname}-${version}.tar.bz2";
17 hash = "sha256-jRtLGDk69DaY0QuqJdK5tjl5ab7srHgWw13QcU5N5Qo=";
18 };
19
20 nativeBuildInputs = [
21 autoreconfHook
22 pkg-config bison flex
23 asciidoc docbook_xml_dtd_45 docbook_xsl findXMLCatalogs libxslt
24 ];
25
26 buildInputs = [
27 libmnl libnftnl libpcap
28 gmp jansson libedit
29 ] ++ lib.optional withXtables iptables
30 ++ lib.optional withPython python3;
31
32 configureFlags = [
33 "--with-json"
34 "--with-cli=editline"
35 ] ++ lib.optional (!withDebugSymbols) "--disable-debug"
36 ++ lib.optional (!withPython) "--disable-python"
37 ++ lib.optional withPython "--enable-python"
38 ++ lib.optional withXtables "--with-xtables";
39
40 meta = with lib; {
41 description = "The project that aims to replace the existing {ip,ip6,arp,eb}tables framework";
42 homepage = "https://netfilter.org/projects/nftables/";
43 license = licenses.gpl2Only;
44 platforms = platforms.linux;
45 maintainers = with maintainers; [ izorkin ajs124 ];
46 mainProgram = "nft";
47 };
48}