1{ stdenv, fetchurl, fetchgit, openssl, zlib, pcre, libxml2, libxslt, expat 2, rtmp ? false 3, fullWebDAV ? false 4, syslog ? false 5, moreheaders ? false, ...}: 6 7let 8 version = "1.4.4"; 9 mainSrc = fetchurl { 10 url = "http://nginx.org/download/nginx-${version}.tar.gz"; 11 sha256 = "1f82845mpgmhvm151fhn2cnqjggw9w7cvsqbva9rb320wmc9m63w"; 12 }; 13 14 rtmp-ext = fetchgit { 15 url = git://github.com/arut/nginx-rtmp-module.git; 16 rev = "1cfb7aeb582789f3b15a03da5b662d1811e2a3f1"; 17 sha256 = "03ikfd2l8mzsjwx896l07rdrw5jn7jjfdiyl572yb9jfrnk48fwi"; 18 }; 19 20 dav-ext = fetchgit { 21 url = git://github.com/arut/nginx-dav-ext-module.git; 22 rev = "54cebc1f21fc13391aae692c6cce672fa7986f9d"; 23 sha256 = "1dvpq1fg5rslnl05z8jc39sgnvh3akam9qxfl033akpczq1bh8nq"; 24 }; 25 26 syslog-ext = fetchgit { 27 url = https://github.com/yaoweibin/nginx_syslog_patch.git; 28 rev = "165affd9741f0e30c4c8225da5e487d33832aca3"; 29 sha256 = "14dkkafjnbapp6jnvrjg9ip46j00cr8pqc2g7374z9aj7hrvdvhs"; 30 }; 31 32 moreheaders-ext = fetchgit { 33 url = https://github.com/agentzh/headers-more-nginx-module.git; 34 rev = "refs/tags/v0.23"; 35 sha256 = "12pbjgsxnvcf2ff2i2qdn39q4cm5czlgrng96j8ml4cgxvnbdh39"; 36 }; 37in 38 39stdenv.mkDerivation rec { 40 name = "nginx-${version}"; 41 src = mainSrc; 42 43 buildInputs = [ openssl zlib pcre libxml2 libxslt 44 ] ++ stdenv.lib.optional fullWebDAV expat; 45 46 patches = if syslog then [ "${syslog-ext}/syslog_1.4.0.patch" ] else []; 47 48 configureFlags = [ 49 "--with-http_ssl_module" 50 "--with-http_spdy_module" 51 "--with-http_xslt_module" 52 "--with-http_sub_module" 53 "--with-http_dav_module" 54 "--with-http_gzip_static_module" 55 "--with-http_secure_link_module" 56 "--with-ipv6" 57 # Install destination problems 58 # "--with-http_perl_module" 59 ] ++ stdenv.lib.optional rtmp "--add-module=${rtmp-ext}" 60 ++ stdenv.lib.optional fullWebDAV "--add-module=${dav-ext}" 61 ++ stdenv.lib.optional syslog "--add-module=${syslog-ext}" 62 ++ stdenv.lib.optional moreheaders "--add-module=${moreheaders-ext}"; 63 64 preConfigure = '' 65 export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${libxml2 }/include/libxml2" 66 ''; 67 68 # escape example 69 postInstall = '' 70 mv $out/sbin $out/bin ''' ''${ 71 ${ if true then ${ "" } else false } 72 ''; 73 74 meta = { 75 description = "A reverse proxy and lightweight webserver"; 76 maintainers = [ stdenv.lib.maintainers.raskin]; 77 platforms = stdenv.lib.platforms.all; 78 inherit version; 79 }; 80} 81