@@ -1,16 +1,6 @@
11{ stdenv, fetchurl, fetchFromGitHub, openssl, zlib, pcre, libxml2, libxslt, expat
2−, gd, geoip, luajit
3−, curl, apr, aprutil, apacheHttpd, yajl, libcap, modsecurity_standalone
4−, rtmp ? false
5−, fullWebDAV ? false
6−, syslog ? false
7−, moreheaders ? false
8−, echo ? false
9−, modsecurity ? false
10−, ngx_lua ? modsecurity || false
11−, set_misc ? false
12−, fluent ? false
13−, extraModules ? []
2+, gd, geoip
3+, modules ? []
144}:
155
166with stdenv.lib;
@@ -22,72 +12,6 @@ let
2212 sha256 = "1mgkkmmwkhmpn68sdvbd73ssv6lpqhh864fsyvc1ij4hk4is3k13";
2313 };
2414
25− rtmp-ext = fetchFromGitHub {
26− owner = "arut";
27− repo = "nginx-rtmp-module";
28− rev = "v1.1.7";
29− sha256 = "0i0fa1znkj7cipy5nlkw4k40klhp9jzk28wxy2vrvd2jvh91x3ma";
30− };
31−
32− dav-ext = fetchFromGitHub {
33− owner = "arut";
34− repo = "nginx-dav-ext-module";
35− rev = "v0.0.3";
36− sha256 = "1qck8jclxddncjad8yv911s9z7lrd58bp96jf13m0iqk54xghx91";
37− };
38−
39− syslog-ext = fetchFromGitHub {
40− owner = "yaoweibin";
41− repo = "nginx_syslog_patch";
42− rev = "3ca5ba65541637f74467038aa032e2586321d0cb";
43− sha256 = "0y8dxkx8m1jw4v5zsvw1gfah9vh3ryq0hfmrcbjzcmwp5b5lb1i8";
44− };
45−
46− moreheaders-ext = fetchFromGitHub {
47− owner = "openresty";
48− repo = "headers-more-nginx-module";
49− rev = "v0.26";
50− sha256 = "01wkqhk8mk8jgmzi7jbzmg5kamffx3lmhj5yfwryvnvs6xqs74wn";
51− };
52−
53− modsecurity-ext = modsecurity_standalone.nginx;
54−
55− echo-ext = fetchFromGitHub {
56− owner = "openresty";
57− repo = "echo-nginx-module";
58− rev = "v0.57";
59− sha256 = "1q0f0zprcn0ypl2qh964cq186l3f40p0z7n7x22m8cxj367vf000";
60− };
61−
62− lua-ext = fetchFromGitHub {
63− owner = "openresty";
64− repo = "lua-nginx-module";
65− rev = "v0.9.16";
66− sha256 = "0dvdam228jhsrayb22ishljdkgib08bakh8ygn84sq0c2xbidzlp";
67− };
68−
69− set-misc-ext = fetchFromGitHub {
70− owner = "openresty";
71− repo = "set-misc-nginx-module";
72− rev = "v0.28";
73− sha256 = "1vixj60q0liri7k5ax85grj7q9vvgybkx421bwphbhai5xrjip96";
74− };
75−
76− fluentd = fetchFromGitHub {
77− owner = "fluent";
78− repo = "nginx-fluentd-module";
79− rev = "8af234043059c857be27879bc547c141eafd5c13";
80− sha256 = "1ycb5zd9sw60ra53jpak1m73zwrjikwhrrh9q6266h1mlyns7zxm";
81− };
82−
83− develkit-ext = fetchFromGitHub {
84− owner = "simpl";
85− repo = "ngx_devel_kit";
86− rev = "v0.2.19";
87− sha256 = "1cqcasp4lc6yq5pihfcdw4vp4wicngvdc3nqg3bg52r63c1qrz76";
88− };
89−
90−
9115in
9216
9317stdenv.mkDerivation rec {
@@ -95,15 +19,8 @@ stdenv.mkDerivation rec {
9519 src = mainSrc;
9620
9721 buildInputs =
98− [ openssl zlib pcre libxml2 libxslt gd geoip
99− ] ++ optional fullWebDAV expat
100− ++ optional ngx_lua luajit
101− ++ optionals modsecurity [ curl apr aprutil apacheHttpd yajl ];
102−
103− LUAJIT_LIB = if ngx_lua then "${luajit}/lib" else "";
104− LUAJIT_INC = if ngx_lua then "${luajit}/include/luajit-2.0" else "";
105−
106− patches = if syslog then [ "${syslog-ext}/syslog-1.5.6.patch" ] else [];
22+ [ openssl zlib pcre libxml2 libxslt gd geoip ]
23+ ++ concatMap (mod: mod.inputs or []) modules;
10724
10825 configureFlags = [
10926 "--with-select_module"
@@ -130,27 +47,13 @@ stdenv.mkDerivation rec {
13047 "--with-ipv6"
13148 # Install destination problems
13249 # "--with-http_perl_module"
133− ] ++ optional rtmp "--add-module=${rtmp-ext}"
134− ++ optional fullWebDAV "--add-module=${dav-ext}"
135− ++ optional syslog "--add-module=${syslog-ext}"
136− ++ optional moreheaders "--add-module=${moreheaders-ext}"
137− ++ optional echo "--add-module=${echo-ext}"
138− ++ optional ngx_lua "--add-module=${develkit-ext} --add-module=${lua-ext}"
139− ++ optional set_misc "--add-module=${set-misc-ext}"
140− ++ optionals (elem stdenv.system (with platforms; linux ++ freebsd))
50+ ] ++ optionals (elem stdenv.system (with platforms; linux ++ freebsd))
14151 [ "--with-file-aio" "--with-aio_module" ]
142− ++ optional fluent "--add-module=${fluentd}"
143− ++ optional modsecurity "--add-module=${modsecurity-ext}/nginx/modsecurity"
144− ++ (map (m: "--add-module=${m}") extraModules);
145−
146−
147− additionalFlags = optionalString stdenv.isDarwin "-Wno-error=deprecated-declarations -Wno-error=conditional-uninitialized";
52+ ++ map (mod: "--add-module=${mod.src}") modules;
14853
149− NIX_CFLAGS_COMPILE = optionalString modsecurity "-I${aprutil}/include/apr-1 -I${apacheHttpd}/include -I${apr}/include/apr-1 -I${yajl}/include";
54+ NIX_CFLAGS_COMPILE = [ "-I${libxml2}/include/libxml2" ] ++ optional stdenv.isDarwin "-Wno-error=deprecated-declarations -Wno-error=conditional-uninitialized";
15055
151− preConfigure = ''
152− export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${libxml2}/include/libxml2 $additionalFlags"
153− '';
56+ preConfigure = concatMapStringsSep "\n" (mod: mod.preConfigure or "") modules;
15457
15558 meta = {
15659 description = "A reverse proxy and lightweight webserver";