Files
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

96 lines
1.9 KiB
Nix

{
stdenv,
lib,
fetchFromGitHub,
pkg-config,
autoreconfHook,
curl,
apacheHttpd,
pcre,
apr,
aprutil,
libxml2,
luaSupport ? false,
lua5,
perl,
versionCheckHook,
}:
let
luaValue = if luaSupport then lua5 else "no";
optional = lib.optional;
in
stdenv.mkDerivation (finalAttrs: {
pname = "modsecurity";
version = "2.9.12";
src = fetchFromGitHub {
owner = "owasp-modsecurity";
repo = "modsecurity";
tag = "v${finalAttrs.version}";
hash = "sha256-scMOiu8oI3+VcXe05gLNQ8ILmnP4iwls8ZZ9r+3ei5Y=";
};
nativeBuildInputs = [
pkg-config
autoreconfHook
];
buildInputs = [
curl
apacheHttpd
pcre
apr
aprutil
libxml2
]
++ optional luaSupport lua5;
configureFlags = [
"--enable-standalone-module"
"--enable-static"
"--with-curl=${curl.dev}"
"--with-apxs=${apacheHttpd.dev}/bin/apxs"
"--with-pcre=${pcre.dev}"
"--with-apr=${apr.dev}"
"--with-apu=${aprutil.dev}/bin/apu-1-config"
"--with-libxml=${libxml2.dev}"
"--with-lua=${luaValue}"
];
enableParallelBuilding = true;
outputs = [
"out"
"nginx"
];
patches = [
# by default modsecurity's install script copies compiled output to httpd's modules folder
# this patch removes those lines
./Makefile.am.patch
];
doCheck = true;
nativeCheckInputs = [ perl ];
postInstall = ''
mkdir -p $nginx
cp -R * $nginx
'';
doInstallCheck = true;
nativeInstallCheckInputs = [
versionCheckHook
];
versionCheckProgramArg = "-v";
versionCheckProgram = "${placeholder "out"}/bin/mlogc";
meta = {
description = "Open source, cross-platform web application firewall (WAF)";
license = lib.licenses.asl20;
homepage = "https://github.com/owasp-modsecurity/ModSecurity";
maintainers = with lib.maintainers; [ offline ];
platforms = lib.platforms.linux ++ lib.platforms.darwin;
};
})