Skip to content

Instantly share code, notes, and snippets.

@haruue
Last active May 18, 2023 09:38
Show Gist options
  • Save haruue/54a523e50810c69915f78972c9b3c9e9 to your computer and use it in GitHub Desktop.
Save haruue/54a523e50810c69915f78972c9b3c9e9 to your computer and use it in GitHub Desktop.
Nix packages for xtables-addons
{ stdenv, lib, linuxPackages, kernel ? linuxPackages.kernel, kmod }:
let
kbuilddir = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build";
in
stdenv.mkDerivation rec {
name = "xtables-addons-kmod-${version}-${kernel.version}";
version = "3.24";
src = fetchTarball {
url = "https://inai.de/files/xtables-addons/xtables-addons-${version}.tar.xz";
};
hardeningDisable = [ "pic" ];
nativeBuildInputs = kernel.moduleBuildDependencies;
configurePhase = "true";
buildPhase = ''
make -j$(nproc) -C ${kbuilddir} M=$PWD/extensions XA_ABSTOPSRCDIR=$PWD modules
'';
installPhase = ''
mkdir $out
make -C ${kbuilddir} M=$PWD/extensions XA_ABSTOPSRCDIR=$PWD INSTALL_MOD_PATH=$out modules_install
'';
meta = with lib; {
description = "Additional extensions for Xtables packet filter (kernel module)";
homepage = "https://inai.de/projects/xtables-addons/";
license = licenses.gpl2;
platforms = platforms.linux;
};
}
{ stdenv, lib, iptables, pkgconfig }:
stdenv.mkDerivation rec {
pname = "xtables-addons-usermod";
version = "3.24";
libraries = [
iptables
pkgconfig
];
buildInputs = libraries;
src = fetchTarball {
url = "https://inai.de/files/xtables-addons/xtables-addons-${version}.tar.xz";
};
configureFlags = [
"--with-xtlibdir=$(out)/lib/xtables"
"--without-kbuild"
];
enableParallelBuilding = true;
meta = with lib; {
description = "Additional extensions for Xtables packet filter (userspace libraries)";
homepage = "https://inai.de/projects/xtables-addons/";
license = licenses.gpl2;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment