2023-04-01 12:17:58 +02:00
|
|
|
{ lib, stdenv, fetchurl
|
|
|
|
, autoreconfHook, pkg-config, pruneLibtoolFiles, flex, bison
|
2019-08-19 19:20:27 +02:00
|
|
|
, libmnl, libnetfilter_conntrack, libnfnetlink, libnftnl, libpcap
|
2020-02-27 11:47:33 +01:00
|
|
|
, nftablesCompat ? true
|
2023-10-12 12:32:58 +02:00
|
|
|
, gitUpdater
|
2019-08-19 19:20:27 +02:00
|
|
|
}:
|
|
|
|
|
2009-07-23 20:16:24 +02:00
|
|
|
stdenv.mkDerivation rec {
|
2023-10-12 12:32:58 +02:00
|
|
|
version = "1.8.10";
|
2019-08-19 19:20:27 +02:00
|
|
|
pname = "iptables";
|
2008-08-15 11:49:43 +02:00
|
|
|
|
|
|
|
src = fetchurl {
|
2023-04-01 12:17:23 +02:00
|
|
|
url = "https://www.netfilter.org/projects/${pname}/files/${pname}-${version}.tar.xz";
|
2023-10-12 12:32:58 +02:00
|
|
|
sha256 = "XMJVwYk1bjF9BwdVzpNx62Oht4PDRJj7jDAmTzzFnJw=";
|
2008-08-15 11:49:43 +02:00
|
|
|
};
|
|
|
|
|
2022-05-15 10:51:48 +02:00
|
|
|
outputs = [ "out" "dev" "man" ];
|
|
|
|
|
2023-04-01 12:17:58 +02:00
|
|
|
nativeBuildInputs = [
|
|
|
|
autoreconfHook pkg-config pruneLibtoolFiles flex bison
|
|
|
|
];
|
2016-01-01 02:54:56 +01:00
|
|
|
|
2019-08-19 19:20:27 +02:00
|
|
|
buildInputs = [ libmnl libnetfilter_conntrack libnfnetlink libnftnl libpcap ];
|
2016-01-01 02:54:56 +01:00
|
|
|
|
2018-07-25 23:44:21 +02:00
|
|
|
configureFlags = [
|
2019-08-19 19:20:27 +02:00
|
|
|
"--enable-bpf-compiler"
|
2018-07-25 23:44:21 +02:00
|
|
|
"--enable-devel"
|
2019-08-19 19:20:27 +02:00
|
|
|
"--enable-libipq"
|
|
|
|
"--enable-nfsynproxy"
|
2018-07-25 23:44:21 +02:00
|
|
|
"--enable-shared"
|
2022-05-15 10:51:48 +02:00
|
|
|
] ++ lib.optional (!nftablesCompat) "--disable-nftables";
|
2017-01-22 02:20:00 +01:00
|
|
|
|
2023-10-12 12:32:58 +02:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2022-05-15 10:51:48 +02:00
|
|
|
postInstall = lib.optionalString nftablesCompat ''
|
2019-08-19 19:20:27 +02: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
|
|
|
|
'';
|
|
|
|
|
2023-10-12 12:32:58 +02:00
|
|
|
passthru = {
|
|
|
|
updateScript = gitUpdater {
|
|
|
|
url = "https://git.netfilter.org/iptables";
|
|
|
|
rev-prefix = "v";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-05-15 10:51:48 +02:00
|
|
|
meta = with lib; {
|
2008-08-15 11:49:43 +02:00
|
|
|
description = "A program to configure the Linux IP packet filtering ruleset";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://www.netfilter.org/projects/iptables/index.html";
|
2017-01-22 02:20:00 +01:00
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ fpletz ];
|
2018-08-30 00:34:22 +02:00
|
|
|
license = licenses.gpl2;
|
2018-11-29 22:44:29 +01:00
|
|
|
downloadPage = "https://www.netfilter.org/projects/iptables/files/";
|
2008-08-15 11:49:43 +02:00
|
|
|
};
|
|
|
|
}
|