depot/third_party/nixpkgs/pkgs/tools/security/modsecurity/default.nix
Default email 8ac5e011d6 Project import generated by Copybara.
GitOrigin-RevId: 2c3273caa153ee8eb5786bc8141b85b859e7efd7
2020-04-24 19:36:52 -04:00

54 lines
1.5 KiB
Nix

{ stdenv, lib, fetchurl, pkgconfig
, curl, apacheHttpd, pcre, apr, aprutil, libxml2
, luaSupport ? false, lua5
}:
with lib;
let luaValue = if luaSupport then lua5 else "no";
optional = stdenv.lib.optional;
in
stdenv.mkDerivation rec {
pname = "modsecurity";
version = "2.9.3";
src = fetchurl {
url = "https://www.modsecurity.org/tarball/${version}/${pname}-${version}.tar.gz";
sha256 = "0611nskd2y6yagrciqafxdn4rxbdk2v4swf45kc1sgwx2sfh34j1";
};
nativeBuildInputs = [ pkgconfig ];
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}"
];
outputs = ["out" "nginx"];
# by default modsecurity's install script copies compiled output to httpd's modules folder
# this patch removes those lines
patches = [ ./Makefile.in.patch ];
postInstall = ''
mkdir -p $nginx
cp -R * $nginx
'';
meta = {
description = "Open source, cross-platform web application firewall (WAF)";
license = licenses.asl20;
homepage = "https://www.modsecurity.org/";
maintainers = with maintainers; [offline];
platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
};
}