lol
1{ lib, stdenv, fetchurl, perl, zlib, apr, aprutil, pcre2, libiconv, lynx, which, libxcrypt
2, nixosTests
3, proxySupport ? true
4, sslSupport ? true, openssl
5, http2Support ? true, nghttp2
6, ldapSupport ? true, openldap
7, libxml2Support ? true, libxml2
8, brotliSupport ? true, brotli
9, luaSupport ? false, lua5
10}:
11
12stdenv.mkDerivation rec {
13 pname = "apache-httpd";
14 version = "2.4.54";
15
16 src = fetchurl {
17 url = "mirror://apache/httpd/httpd-${version}.tar.bz2";
18 sha256 = "sha256-6zl/7u/MryVPjUXeN2jZ1o6Oc4UcSa/VtxdtHs+Aw0A=";
19 };
20
21 # FIXME: -dev depends on -doc
22 outputs = [ "out" "dev" "man" "doc" ];
23 setOutputFlags = false; # it would move $out/modules, etc.
24
25 nativeBuildInputs = [ which ];
26
27 buildInputs = [ perl libxcrypt ] ++
28 lib.optional brotliSupport brotli ++
29 lib.optional sslSupport openssl ++
30 lib.optional ldapSupport openldap ++ # there is no --with-ldap flag
31 lib.optional libxml2Support libxml2 ++
32 lib.optional http2Support nghttp2 ++
33 lib.optional stdenv.isDarwin libiconv;
34
35 postPatch = ''
36 sed -i config.layout -e "s|installbuilddir:.*|installbuilddir: $dev/share/build|"
37 sed -i support/apachectl.in -e 's|@LYNX_PATH@|${lynx}/bin/lynx|'
38 '';
39
40 # Required for ‘pthread_cancel’.
41 NIX_LDFLAGS = lib.optionalString (!stdenv.isDarwin) "-lgcc_s";
42
43 configureFlags = [
44 "--with-apr=${apr.dev}"
45 "--with-apr-util=${aprutil.dev}"
46 "--with-z=${zlib.dev}"
47 "--with-pcre=${pcre2.dev}/bin/pcre2-config"
48 "--disable-maintainer-mode"
49 "--disable-debugger-mode"
50 "--enable-mods-shared=all"
51 "--enable-mpms-shared=all"
52 "--enable-cern-meta"
53 "--enable-imagemap"
54 "--enable-cgi"
55 "--includedir=${placeholder "dev"}/include"
56 (lib.enableFeature proxySupport "proxy")
57 (lib.enableFeature sslSupport "ssl")
58 (lib.withFeatureAs libxml2Support "libxml2" "${libxml2.dev}/include/libxml2")
59 "--docdir=$(doc)/share/doc"
60
61 (lib.enableFeature brotliSupport "brotli")
62 (lib.withFeatureAs brotliSupport "brotli" brotli)
63
64 (lib.enableFeature http2Support "http2")
65 (lib.withFeature http2Support "nghttp2")
66
67 (lib.enableFeature luaSupport "lua")
68 (lib.withFeatureAs luaSupport "lua" lua5)
69 ];
70
71 enableParallelBuilding = true;
72
73 stripDebugList = [ "lib" "modules" "bin" ];
74
75 postInstall = ''
76 mkdir -p $doc/share/doc/httpd
77 mv $out/manual $doc/share/doc/httpd
78 mkdir -p $dev/bin
79 mv $out/bin/apxs $dev/bin/apxs
80 '';
81
82 passthru = {
83 inherit apr aprutil sslSupport proxySupport ldapSupport luaSupport lua5;
84 tests = {
85 acme-integration = nixosTests.acme;
86 proxy = nixosTests.proxy;
87 php = nixosTests.php.httpd;
88 };
89 };
90
91 meta = with lib; {
92 description = "Apache HTTPD, the world's most popular web server";
93 homepage = "https://httpd.apache.org/";
94 license = licenses.asl20;
95 platforms = platforms.linux ++ platforms.darwin;
96 maintainers = with maintainers; [ lovek323 ];
97 };
98}