1 { lib, stdenv, fetchFromGitHub, openssl, zlib, pcre, libxcrypt, libxml2, libxslt
2 , substituteAll, gd, geoip, gperftools, jemalloc, nixosTests
12 stdenv.mkDerivation rec {
16 src = fetchFromGitHub {
20 hash = "sha256-cClSNBlresMHqJrqSFWvUo589TlwJ2tL5FWJG9QBuis=";
24 [ openssl zlib pcre libxcrypt libxml2 libxslt gd geoip gperftools jemalloc ]
25 ++ concatMap (mod: mod.inputs or []) modules;
27 patches = singleton (substituteAll {
28 src = ../nginx/nix-etag-1.15.4.patch;
30 export nixStoreDir="$NIX_STORE" nixStoreDirLen="''${#NIX_STORE}"
33 ./check-resolv-conf.patch
34 ../nginx/nix-skip-check-logs-path.patch
38 "--with-http_ssl_module"
39 "--with-http_v2_module"
40 "--with-http_realip_module"
41 "--with-http_addition_module"
42 "--with-http_xslt_module"
43 "--with-http_geoip_module"
44 "--with-http_sub_module"
45 "--with-http_dav_module"
46 "--with-http_flv_module"
47 "--with-http_mp4_module"
48 "--with-http_gunzip_module"
49 "--with-http_gzip_static_module"
50 "--with-http_auth_request_module"
51 "--with-http_random_index_module"
52 "--with-http_secure_link_module"
53 "--with-http_degradation_module"
54 "--with-http_stub_status_module"
57 "--with-http_slice_module"
58 "--with-select_module"
60 "--with-google_perftools_module"
62 "--http-log-path=/var/log/nginx/access.log"
63 "--error-log-path=/var/log/nginx/error.log"
64 "--pid-path=/var/log/nginx/nginx.pid"
65 "--http-client-body-temp-path=/var/cache/nginx/client_body"
66 "--http-proxy-temp-path=/var/cache/nginx/proxy"
67 "--http-fastcgi-temp-path=/var/cache/nginx/fastcgi"
68 "--http-uwsgi-temp-path=/var/cache/nginx/uwsgi"
69 "--http-scgi-temp-path=/var/cache/nginx/scgi"
70 ] ++ optionals withDebug [
72 ] ++ optionals withMail [
74 "--with-mail_ssl_module"
75 ] ++ optionals (!withMail) [
76 "--without-mail_pop3_module"
77 "--without-mail_imap_module"
78 "--without-mail_smtp_module"
79 ] ++ optionals withStream [
81 "--with-stream_ssl_module"
82 "--with-stream_realip_module"
83 "--with-stream_geoip_module"
84 "--with-stream_ssl_preread_module"
86 ] ++ optionals (!withStream) [
87 "--without-stream_limit_conn_module"
88 "--without-stream_access_module"
89 "--without-stream_geo_module"
90 "--without-stream_map_module"
91 "--without-stream_split_clients_module"
92 "--without-stream_return_module"
93 "--without-stream_upstream_hash_module"
94 "--without-stream_upstream_least_conn_module"
95 "--without-stream_upstream_random_module"
96 "--without-stream_upstream_zone_module"
97 ] ++ optional (gd != null) "--with-http_image_filter_module"
98 ++ optional (with stdenv.hostPlatform; isLinux || isFreeBSD) "--with-file-aio"
99 ++ map (mod: "--add-module=${mod.src}") modules;
101 env.NIX_CFLAGS_COMPILE = "-I${libxml2.dev}/include/libxml2 -Wno-error=implicit-fallthrough"
102 + optionalString stdenv.isDarwin " -Wno-error=deprecated-declarations";
104 preConfigure = (concatMapStringsSep "\n" (mod: mod.preConfigure or "") modules);
106 hardeningEnable = optional (!stdenv.isDarwin) "pie";
108 enableParallelBuilding = true;
111 mv $out/sbin $out/bin
116 tests = nixosTests.nginx-variants.tengine;
120 description = "A web server based on Nginx and has many advanced features, originated by Taobao";
121 mainProgram = "nginx";
122 homepage = "https://tengine.taobao.org";
123 license = licenses.bsd2;
124 platforms = platforms.all;
125 maintainers = with maintainers; [ izorkin ];