biglybt: 3.5.0.0 -> 3.6.0.0
[NixPkgs.git] / pkgs / servers / http / tengine / default.nix
blob591f180893b325829e332af7ce9fcba894bcd8e1
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 with lib;
12 stdenv.mkDerivation rec {
13   version = "3.1.0";
14   pname = "tengine";
16   src = fetchFromGitHub {
17     owner = "alibaba";
18     repo = pname;
19     rev = version;
20     hash = "sha256-cClSNBlresMHqJrqSFWvUo589TlwJ2tL5FWJG9QBuis=";
21   };
23   buildInputs =
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;
29     preInstall = ''
30       export nixStoreDir="$NIX_STORE" nixStoreDirLen="''${#NIX_STORE}"
31     '';
32   }) ++ [
33     ./check-resolv-conf.patch
34     ../nginx/nix-skip-check-logs-path.patch
35   ];
37   configureFlags = [
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"
55     "--with-threads"
56     "--with-pcre-jit"
57     "--with-http_slice_module"
58     "--with-select_module"
59     "--with-poll_module"
60     "--with-google_perftools_module"
61     "--with-jemalloc"
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 [
71     "--with-debug"
72   ] ++ optionals withMail [
73     "--with-mail"
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 [
80     "--with-stream"
81     "--with-stream_ssl_module"
82     "--with-stream_realip_module"
83     "--with-stream_geoip_module"
84     "--with-stream_ssl_preread_module"
85     "--with-stream_sni"
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;
110   postInstall = ''
111     mv $out/sbin $out/bin
112   '';
114   passthru = {
115     inherit modules;
116     tests = nixosTests.nginx-variants.tengine;
117   };
119   meta = {
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 ];
126   };