2013-11-18 16:02:33 +01:00
|
|
|
{ stdenv, fetchurl, fetchgit, openssl, zlib, pcre, libxml2, libxslt, expat
|
2014-05-02 08:18:44 +02:00
|
|
|
, gd, geoip
|
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
|
|
|
|
, echo ? false }:
|
|
|
|
|
|
|
|
with stdenv.lib;
|
2012-10-09 20:20:44 +02:00
|
|
|
|
2013-05-05 21:48:07 +02:00
|
|
|
let
|
2014-05-02 08:18:44 +02:00
|
|
|
version = "1.6.0";
|
2013-11-25 07:58:34 +01:00
|
|
|
mainSrc = fetchurl {
|
|
|
|
url = "http://nginx.org/download/nginx-${version}.tar.gz";
|
2014-05-02 08:18:44 +02:00
|
|
|
sha256 = "06pwmg4qyd1sirpyl47s6qp94qc8a36dlkaw5pgv7s63l5bxffll";
|
2013-11-25 07:58:34 +01:00
|
|
|
};
|
|
|
|
|
2013-11-18 16:02:33 +01:00
|
|
|
rtmp-ext = fetchgit {
|
2014-05-02 08:18:44 +02:00
|
|
|
url = https://github.com/arut/nginx-rtmp-module.git;
|
|
|
|
rev = "8c2229cce5d4d4574e8fb7b130281497f746f0fa";
|
|
|
|
sha256 = "6caea2a13161345c3fc963679730be54cebebddf1406ac7d4ef4ce72ac0b90b0";
|
2013-11-18 16:02:33 +01:00
|
|
|
};
|
|
|
|
|
2013-05-05 21:48:07 +02:00
|
|
|
dav-ext = fetchgit {
|
2014-05-02 08:18:44 +02:00
|
|
|
url = "https://github.com/arut/nginx-dav-ext-module";
|
|
|
|
rev = "89d582d31ab624ff1c6a4cec0c1a52839507b323";
|
|
|
|
sha256 = "2175f83a291347504770d2a4bb5069999e9f7408697bd49464b6b54e994493e1";
|
2013-05-05 21:48:07 +02:00
|
|
|
};
|
2013-10-10 02:38:47 +02:00
|
|
|
|
|
|
|
syslog-ext = fetchgit {
|
|
|
|
url = https://github.com/yaoweibin/nginx_syslog_patch.git;
|
2014-05-07 23:53:28 +02:00
|
|
|
rev = "3ca5ba65541637f74467038aa032e2586321d0cb";
|
|
|
|
sha256 = "15z9r17lx42fdcw8lalddc86wpabgmc1rqi7f90v4mcirjzrpgyi";
|
2013-10-10 02:38:47 +02:00
|
|
|
};
|
2013-12-13 09:38:09 +01:00
|
|
|
|
|
|
|
moreheaders-ext = fetchgit {
|
2014-05-02 08:18:44 +02:00
|
|
|
url = https://github.com/openresty/headers-more-nginx-module.git;
|
|
|
|
rev = "0c6e05d3125a97892a250e9ba8b7674163ba500b";
|
|
|
|
sha256 = "e121d97fd3c81c64e6cbf6902bbcbdb01be9ac985c6832d40434379d5e998eaf";
|
2013-12-13 09:38:09 +01:00
|
|
|
};
|
2014-06-03 15:59:08 +02:00
|
|
|
|
|
|
|
echo-ext = fetchgit {
|
|
|
|
url = https://github.com/openresty/echo-nginx-module.git;
|
|
|
|
rev = "refs/tags/v0.53";
|
|
|
|
sha256 = "90d4e3a49c678019f4f335bc18529aa108fcc9cfe0747ea4e2f6084a70da2868";
|
|
|
|
};
|
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-06-03 15:59:08 +02:00
|
|
|
] ++ optional fullWebDAV expat;
|
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}"
|
|
|
|
++ optional (elem stdenv.system (with platforms; linux ++ freebsd)) "--with-file-aio";
|
|
|
|
|
2008-11-30 10:06:53 +01:00
|
|
|
|
2014-06-03 15:59:08 +02:00
|
|
|
additionalFlags = optionalString stdenv.isDarwin "-Wno-error=deprecated-declarations";
|
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
|
|
|
};
|
|
|
|
}
|