nfs-ganesha: 6.2 -> 6.3 (#359179)
[NixPkgs.git] / pkgs / servers / http / tengine / default.nix
blobbddb334e8c5d48ca28ef32b1cf1be7075c82deb7
1 { lib, stdenv, fetchFromGitHub, openssl, zlib, pcre, libxcrypt, libxml2, libxslt
2 , substituteAll, gd, geoip, gperftools, jemalloc, nixosTests
3 , withDebug ? false
4 , withMail ? false
5 , withStream ? false
6 , modules ? []
7 , ...
8 }:
10 let
11   inherit (lib) optional optionals optionalString;
13 stdenv.mkDerivation rec {
14   version = "3.1.0";
15   pname = "tengine";
17   src = fetchFromGitHub {
18     owner = "alibaba";
19     repo = pname;
20     rev = version;
21     hash = "sha256-cClSNBlresMHqJrqSFWvUo589TlwJ2tL5FWJG9QBuis=";
22   };
24   buildInputs =
25     [ openssl zlib pcre libxcrypt libxml2 libxslt gd geoip gperftools jemalloc ]
26     ++ lib.concatMap (mod: mod.inputs or []) modules;
28   patches = lib.singleton (substituteAll {
29     src = ../nginx/nix-etag-1.15.4.patch;
30     preInstall = ''
31       export nixStoreDir="$NIX_STORE" nixStoreDirLen="''${#NIX_STORE}"
32     '';
33   }) ++ [
34     ./check-resolv-conf.patch
35     ../nginx/nix-skip-check-logs-path.patch
36   ];
38   configureFlags = [
39     "--with-http_ssl_module"
40     "--with-http_v2_module"
41     "--with-http_realip_module"
42     "--with-http_addition_module"
43     "--with-http_xslt_module"
44     "--with-http_geoip_module"
45     "--with-http_sub_module"
46     "--with-http_dav_module"
47     "--with-http_flv_module"
48     "--with-http_mp4_module"
49     "--with-http_gunzip_module"
50     "--with-http_gzip_static_module"
51     "--with-http_auth_request_module"
52     "--with-http_random_index_module"
53     "--with-http_secure_link_module"
54     "--with-http_degradation_module"
55     "--with-http_stub_status_module"
56     "--with-threads"
57     "--with-pcre-jit"
58     "--with-http_slice_module"
59     "--with-select_module"
60     "--with-poll_module"
61     "--with-google_perftools_module"
62     "--with-jemalloc"
63     "--http-log-path=/var/log/nginx/access.log"
64     "--error-log-path=/var/log/nginx/error.log"
65     "--pid-path=/var/log/nginx/nginx.pid"
66     "--http-client-body-temp-path=/var/cache/nginx/client_body"
67     "--http-proxy-temp-path=/var/cache/nginx/proxy"
68     "--http-fastcgi-temp-path=/var/cache/nginx/fastcgi"
69     "--http-uwsgi-temp-path=/var/cache/nginx/uwsgi"
70     "--http-scgi-temp-path=/var/cache/nginx/scgi"
71   ] ++ optionals withDebug [
72     "--with-debug"
73   ] ++ optionals withMail [
74     "--with-mail"
75     "--with-mail_ssl_module"
76   ] ++ optionals (!withMail) [
77     "--without-mail_pop3_module"
78     "--without-mail_imap_module"
79     "--without-mail_smtp_module"
80   ] ++ optionals withStream [
81     "--with-stream"
82     "--with-stream_ssl_module"
83     "--with-stream_realip_module"
84     "--with-stream_geoip_module"
85     "--with-stream_ssl_preread_module"
86     "--with-stream_sni"
87   ] ++ optionals (!withStream) [
88     "--without-stream_limit_conn_module"
89     "--without-stream_access_module"
90     "--without-stream_geo_module"
91     "--without-stream_map_module"
92     "--without-stream_split_clients_module"
93     "--without-stream_return_module"
94     "--without-stream_upstream_hash_module"
95     "--without-stream_upstream_least_conn_module"
96     "--without-stream_upstream_random_module"
97     "--without-stream_upstream_zone_module"
98   ] ++ optional (gd != null) "--with-http_image_filter_module"
99     ++ optional (with stdenv.hostPlatform; isLinux || isFreeBSD) "--with-file-aio"
100     ++ map (mod: "--add-module=${mod.src}") modules;
102   env.NIX_CFLAGS_COMPILE = "-I${libxml2.dev}/include/libxml2 -Wno-error=implicit-fallthrough"
103     + optionalString stdenv.hostPlatform.isDarwin " -Wno-error=deprecated-declarations";
105   preConfigure = (lib.concatMapStringsSep "\n" (mod: mod.preConfigure or "") modules);
107   hardeningEnable = optional (!stdenv.hostPlatform.isDarwin) "pie";
109   enableParallelBuilding = true;
111   postInstall = ''
112     mv $out/sbin $out/bin
113   '';
115   passthru = {
116     inherit modules;
117     tests = nixosTests.nginx-variants.tengine;
118   };
120   meta = with lib; {
121     description = "Web server based on Nginx and has many advanced features, originated by Taobao";
122     mainProgram = "nginx";
123     homepage    = "https://tengine.taobao.org";
124     license     = licenses.bsd2;
125     platforms   = platforms.all;
126     maintainers = with maintainers; [ izorkin ];
127   };