2014-09-20 01:42:02 +02:00
|
|
|
{ stdenv, fetchurl, fetchFromGitHub, openssl, zlib, pcre, libxml2, libxslt, expat
|
2014-08-30 18:41:33 +02:00
|
|
|
, gd, geoip, luajit
|
2013-11-18 16:02:33 +01:00
|
|
|
, rtmp ? false
|
|
|
|
, fullWebDAV ? false
|
2013-12-13 09:38:09 +01:00
|
|
|
, syslog ? false
|
2014-06-03 15:59:08 +02:00
|
|
|
, moreheaders ? false
|
2014-08-30 18:41:33 +02:00
|
|
|
, echo ? false
|
2015-01-21 12:38:34 +01:00
|
|
|
, ngx_lua ? false
|
|
|
|
, set_misc ? false
|
2015-04-15 13:12:32 +02:00
|
|
|
, fluent ? false
|
2015-01-21 12:38:34 +01:00
|
|
|
}:
|
2014-06-03 15:59:08 +02:00
|
|
|
|
|
|
|
with stdenv.lib;
|
2012-10-09 20:20:44 +02:00
|
|
|
|
2013-05-05 21:48:07 +02:00
|
|
|
let
|
2015-04-08 22:17:29 +02:00
|
|
|
version = "1.6.3";
|
2013-11-25 07:58:34 +01:00
|
|
|
mainSrc = fetchurl {
|
|
|
|
url = "http://nginx.org/download/nginx-${version}.tar.gz";
|
2015-04-08 22:17:29 +02:00
|
|
|
sha256 = "0mz7nx1ffw4f024yb4w9kpjd33z1f16zmq9iyd160kbf6rdyk60a";
|
2013-11-25 07:58:34 +01:00
|
|
|
};
|
|
|
|
|
2014-09-20 01:42:02 +02:00
|
|
|
rtmp-ext = fetchFromGitHub {
|
|
|
|
owner = "arut";
|
|
|
|
repo = "nginx-rtmp-module";
|
|
|
|
rev = "v1.1.5";
|
|
|
|
sha256 = "1d9ws4prxz22yq3nhh5h18jrs331zivrdh784l6wznc1chg3gphn";
|
2013-11-18 16:02:33 +01:00
|
|
|
};
|
|
|
|
|
2014-09-20 01:42:02 +02:00
|
|
|
dav-ext = fetchFromGitHub {
|
|
|
|
owner = "arut";
|
|
|
|
repo = "nginx-dav-ext-module";
|
|
|
|
rev = "v0.0.3";
|
|
|
|
sha256 = "1qck8jclxddncjad8yv911s9z7lrd58bp96jf13m0iqk54xghx91";
|
2013-05-05 21:48:07 +02:00
|
|
|
};
|
2013-10-10 02:38:47 +02:00
|
|
|
|
2014-09-20 01:42:02 +02:00
|
|
|
syslog-ext = fetchFromGitHub {
|
|
|
|
owner = "yaoweibin";
|
|
|
|
repo = "nginx_syslog_patch";
|
2015-01-03 20:08:33 +01:00
|
|
|
rev = "3ca5ba65541637f74467038aa032e2586321d0cb";
|
|
|
|
sha256 = "0y8dxkx8m1jw4v5zsvw1gfah9vh3ryq0hfmrcbjzcmwp5b5lb1i8";
|
2013-10-10 02:38:47 +02:00
|
|
|
};
|
2013-12-13 09:38:09 +01:00
|
|
|
|
2014-09-20 01:42:02 +02:00
|
|
|
moreheaders-ext = fetchFromGitHub {
|
|
|
|
owner = "openresty";
|
|
|
|
repo = "headers-more-nginx-module";
|
|
|
|
rev = "v0.25";
|
|
|
|
sha256 = "1d71y1i0smi4gkzz731fhn58gr03b3s6jz6ipnfzxxaizmgxm3rb";
|
2013-12-13 09:38:09 +01:00
|
|
|
};
|
2014-06-03 15:59:08 +02:00
|
|
|
|
2014-09-20 01:42:02 +02:00
|
|
|
echo-ext = fetchFromGitHub {
|
|
|
|
owner = "openresty";
|
|
|
|
repo = "echo-nginx-module";
|
|
|
|
rev = "v0.56";
|
|
|
|
sha256 = "03vaf1ffhkj2s089f90h45n079h3zw47h6y5zpk752f4ydiagpgd";
|
2014-06-03 15:59:08 +02:00
|
|
|
};
|
2014-08-30 18:41:33 +02:00
|
|
|
|
2014-09-20 01:42:02 +02:00
|
|
|
develkit-ext = fetchFromGitHub {
|
|
|
|
owner = "simpl";
|
|
|
|
repo = "ngx_devel_kit";
|
|
|
|
rev = "v0.2.19";
|
|
|
|
sha256 = "1cqcasp4lc6yq5pihfcdw4vp4wicngvdc3nqg3bg52r63c1qrz76";
|
2014-08-30 18:41:33 +02:00
|
|
|
};
|
|
|
|
|
2014-09-20 01:42:02 +02:00
|
|
|
lua-ext = fetchFromGitHub {
|
|
|
|
owner = "openresty";
|
|
|
|
repo = "lua-nginx-module";
|
|
|
|
rev = "v0.9.12";
|
|
|
|
sha256 = "0r07q1n3nvi7m3l8zk7nfk0z9kjhqknav61ys9lshh2ylsmz1lf4";
|
2014-08-30 18:41:33 +02:00
|
|
|
};
|
|
|
|
|
2015-01-21 12:38:34 +01:00
|
|
|
set-misc-ext = fetchFromGitHub {
|
|
|
|
owner = "openresty";
|
|
|
|
repo = "set-misc-nginx-module";
|
|
|
|
rev = "v0.27";
|
|
|
|
sha256 = "1bd1isacsiay73nc2jlp0wky32l42a3sjskvfa1082l12g0p1x39";
|
|
|
|
};
|
|
|
|
|
2015-04-15 13:12:32 +02:00
|
|
|
fluentd = fetchFromGitHub {
|
|
|
|
owner = "fluent";
|
|
|
|
repo = "nginx-fluentd-module";
|
|
|
|
rev = "8af234043059c857be27879bc547c141eafd5c13";
|
|
|
|
sha256 = "1ycb5zd9sw60ra53jpak1m73zwrjikwhrrh9q6266h1mlyns7zxm";
|
|
|
|
};
|
|
|
|
|
2013-05-05 21:48:07 +02:00
|
|
|
in
|
|
|
|
|
2011-10-31 19:26:20 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2013-11-25 07:58:34 +01:00
|
|
|
name = "nginx-${version}";
|
|
|
|
src = mainSrc;
|
2012-10-09 20:20:44 +02:00
|
|
|
|
2014-05-02 08:18:44 +02:00
|
|
|
buildInputs =
|
|
|
|
[ openssl zlib pcre libxml2 libxslt gd geoip
|
2014-08-30 18:41:33 +02:00
|
|
|
] ++ optional fullWebDAV expat
|
|
|
|
++ optional ngx_lua luajit;
|
|
|
|
|
|
|
|
LUAJIT_LIB = if ngx_lua then "${luajit}/lib" else "";
|
|
|
|
LUAJIT_INC = if ngx_lua then "${luajit}/include/luajit-2.0" else "";
|
2008-11-30 10:06:53 +01:00
|
|
|
|
2014-05-07 23:53:28 +02:00
|
|
|
patches = if syslog then [ "${syslog-ext}/syslog-1.5.6.patch" ] else [];
|
2013-10-10 02:38:47 +02:00
|
|
|
|
2008-11-30 10:06:53 +01:00
|
|
|
configureFlags = [
|
|
|
|
"--with-http_ssl_module"
|
2013-12-13 09:41:22 +01:00
|
|
|
"--with-http_spdy_module"
|
2014-05-02 08:18:44 +02:00
|
|
|
"--with-http_realip_module"
|
|
|
|
"--with-http_addition_module"
|
2008-11-30 10:06:53 +01:00
|
|
|
"--with-http_xslt_module"
|
2014-05-02 08:18:44 +02:00
|
|
|
"--with-http_image_filter_module"
|
|
|
|
"--with-http_geoip_module"
|
2008-11-30 10:06:53 +01:00
|
|
|
"--with-http_sub_module"
|
|
|
|
"--with-http_dav_module"
|
2014-05-02 08:18:44 +02:00
|
|
|
"--with-http_flv_module"
|
|
|
|
"--with-http_mp4_module"
|
|
|
|
"--with-http_gunzip_module"
|
2008-11-30 10:06:53 +01:00
|
|
|
"--with-http_gzip_static_module"
|
2014-05-02 08:18:44 +02:00
|
|
|
"--with-http_auth_request_module"
|
|
|
|
"--with-http_random_index_module"
|
2008-11-30 10:06:53 +01:00
|
|
|
"--with-http_secure_link_module"
|
2014-05-02 08:18:44 +02:00
|
|
|
"--with-http_degradation_module"
|
2014-05-02 07:42:40 +02:00
|
|
|
"--with-http_stub_status_module"
|
2013-12-13 09:41:22 +01:00
|
|
|
"--with-ipv6"
|
2010-04-09 13:26:54 +02:00
|
|
|
# Install destination problems
|
2012-10-09 20:20:44 +02:00
|
|
|
# "--with-http_perl_module"
|
2014-06-03 15:59:08 +02:00
|
|
|
] ++ optional rtmp "--add-module=${rtmp-ext}"
|
|
|
|
++ optional fullWebDAV "--add-module=${dav-ext}"
|
|
|
|
++ optional syslog "--add-module=${syslog-ext}"
|
|
|
|
++ optional moreheaders "--add-module=${moreheaders-ext}"
|
|
|
|
++ optional echo "--add-module=${echo-ext}"
|
2014-08-30 18:41:33 +02:00
|
|
|
++ optional ngx_lua "--add-module=${develkit-ext} --add-module=${lua-ext}"
|
2015-01-21 12:38:34 +01:00
|
|
|
++ optional set_misc "--add-module=${set-misc-ext}"
|
2015-04-15 13:12:32 +02:00
|
|
|
++ optional (elem stdenv.system (with platforms; linux ++ freebsd)) "--with-file-aio"
|
|
|
|
++ optional fluent "--add-module=${fluentd}";
|
2014-06-03 15:59:08 +02:00
|
|
|
|
2008-11-30 10:06:53 +01:00
|
|
|
|
2014-08-17 22:17:13 +02:00
|
|
|
additionalFlags = optionalString stdenv.isDarwin "-Wno-error=deprecated-declarations -Wno-error=conditional-uninitialized";
|
2014-05-05 09:18:47 +02:00
|
|
|
|
2011-10-31 19:26:20 +01:00
|
|
|
preConfigure = ''
|
2014-05-05 09:18:47 +02:00
|
|
|
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${libxml2}/include/libxml2 $additionalFlags"
|
2011-10-31 19:26:20 +01:00
|
|
|
'';
|
2008-11-30 10:06:53 +01:00
|
|
|
|
2012-02-19 22:36:34 +01:00
|
|
|
postInstall = ''
|
|
|
|
mv $out/sbin $out/bin
|
|
|
|
'';
|
|
|
|
|
2008-11-30 10:06:53 +01:00
|
|
|
meta = {
|
2012-10-09 20:20:44 +02:00
|
|
|
description = "A reverse proxy and lightweight webserver";
|
2014-05-02 08:18:44 +02:00
|
|
|
homepage = http://nginx.org;
|
2014-06-03 15:59:08 +02:00
|
|
|
license = licenses.bsd2;
|
|
|
|
platforms = platforms.all;
|
|
|
|
maintainers = with maintainers; [ thoughtpolice raskin ];
|
2008-11-30 10:06:53 +01:00
|
|
|
};
|
|
|
|
}
|