2019-08-19 17:20:27 +00:00
|
|
|
{ stdenv, fetchurl, pkgconfig, pruneLibtoolFiles, flex, bison
|
|
|
|
, libmnl, libnetfilter_conntrack, libnfnetlink, libnftnl, libpcap
|
2019-09-22 08:00:41 +00:00
|
|
|
, nftablesCompat ? false
|
2019-08-19 17:20:27 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
with stdenv.lib;
|
2008-08-15 09:49:43 +00:00
|
|
|
|
2009-07-23 18:16:24 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2020-11-02 08:50:11 +00:00
|
|
|
version = "1.8.6";
|
2019-08-19 17:20:27 +00:00
|
|
|
pname = "iptables";
|
2008-08-15 09:49:43 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2019-05-28 22:17:46 +00:00
|
|
|
url = "https://www.netfilter.org/projects/${pname}/files/${pname}-${version}.tar.bz2";
|
2020-11-02 08:50:11 +00:00
|
|
|
sha256 = "0rvp0k8a72h2snrdx48cfn75bfa0ycrd2xl3kjysbymq7q6gxx50";
|
2008-08-15 09:49:43 +00:00
|
|
|
};
|
|
|
|
|
2019-08-19 17:20:27 +00:00
|
|
|
nativeBuildInputs = [ pkgconfig pruneLibtoolFiles flex bison ];
|
2016-01-01 01:54:56 +00:00
|
|
|
|
2019-08-19 17:20:27 +00:00
|
|
|
buildInputs = [ libmnl libnetfilter_conntrack libnfnetlink libnftnl libpcap ];
|
2016-01-01 01:54:56 +00:00
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
export NIX_LDFLAGS="$NIX_LDFLAGS -lmnl -lnftnl"
|
|
|
|
'';
|
|
|
|
|
2018-07-25 21:44:21 +00:00
|
|
|
configureFlags = [
|
2019-08-19 17:20:27 +00:00
|
|
|
"--enable-bpf-compiler"
|
2018-07-25 21:44:21 +00:00
|
|
|
"--enable-devel"
|
2019-08-19 17:20:27 +00:00
|
|
|
"--enable-libipq"
|
|
|
|
"--enable-nfsynproxy"
|
2018-07-25 21:44:21 +00:00
|
|
|
"--enable-shared"
|
2019-09-22 08:00:41 +00:00
|
|
|
] ++ optional (!nftablesCompat) "--disable-nftables";
|
2010-05-20 22:11:44 +00:00
|
|
|
|
2017-01-22 01:20:00 +00:00
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
|
2019-09-22 08:00:41 +00:00
|
|
|
postInstall = optional nftablesCompat ''
|
2019-08-19 17:20:27 +00:00
|
|
|
rm $out/sbin/{iptables,iptables-restore,iptables-save,ip6tables,ip6tables-restore,ip6tables-save}
|
|
|
|
ln -sv xtables-nft-multi $out/bin/iptables
|
|
|
|
ln -sv xtables-nft-multi $out/bin/iptables-restore
|
|
|
|
ln -sv xtables-nft-multi $out/bin/iptables-save
|
|
|
|
ln -sv xtables-nft-multi $out/bin/ip6tables
|
|
|
|
ln -sv xtables-nft-multi $out/bin/ip6tables-restore
|
|
|
|
ln -sv xtables-nft-multi $out/bin/ip6tables-save
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
2008-08-15 09:49:43 +00:00
|
|
|
description = "A program to configure the Linux IP packet filtering ruleset";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://www.netfilter.org/projects/iptables/index.html";
|
2017-01-22 01:20:00 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ fpletz ];
|
2018-08-29 22:34:22 +00:00
|
|
|
license = licenses.gpl2;
|
2018-11-29 21:44:29 +00:00
|
|
|
downloadPage = "https://www.netfilter.org/projects/iptables/files/";
|
2014-12-12 22:16:48 +00:00
|
|
|
updateWalker = true;
|
|
|
|
inherit version;
|
2008-08-15 09:49:43 +00:00
|
|
|
};
|
|
|
|
}
|