1 { lib, stdenv, fetchurl, perl, zlib, apr, aprutil, pcre2, libiconv, lynx, which, libxcrypt
4 , sslSupport ? true, openssl
5 , modTlsSupport ? false, rustls-ffi, Foundation
6 , http2Support ? true, nghttp2
7 , ldapSupport ? true, openldap
8 , libxml2Support ? true, libxml2
9 , brotliSupport ? true, brotli
10 , luaSupport ? false, lua5
13 stdenv.mkDerivation rec {
14 pname = "apache-httpd";
18 url = "mirror://apache/httpd/httpd-${version}.tar.bz2";
19 hash = "sha256-7FFQHsSAKE/1L2NyWBNdMzIwp9Ipw6+m9sL5BA4yEyM=";
22 # FIXME: -dev depends on -doc
23 outputs = [ "out" "dev" "man" "doc" ];
24 setOutputFlags = false; # it would move $out/modules, etc.
26 nativeBuildInputs = [ which ];
28 buildInputs = [ perl libxcrypt ] ++
29 lib.optional brotliSupport brotli ++
30 lib.optional sslSupport openssl ++
31 lib.optional modTlsSupport rustls-ffi ++
32 lib.optional (modTlsSupport && stdenv.isDarwin) Foundation ++
33 lib.optional ldapSupport openldap ++ # there is no --with-ldap flag
34 lib.optional libxml2Support libxml2 ++
35 lib.optional http2Support nghttp2 ++
36 lib.optional stdenv.isDarwin libiconv;
39 sed -i config.layout -e "s|installbuilddir:.*|installbuilddir: $dev/share/build|"
40 sed -i support/apachectl.in -e 's|@LYNX_PATH@|${lynx}/bin/lynx|'
43 # Required for ‘pthread_cancel’.
44 NIX_LDFLAGS = lib.optionalString (!stdenv.isDarwin) "-lgcc_s";
47 "--with-apr=${apr.dev}"
48 "--with-apr-util=${aprutil.dev}"
49 "--with-z=${zlib.dev}"
50 "--with-pcre=${pcre2.dev}/bin/pcre2-config"
51 "--disable-maintainer-mode"
52 "--disable-debugger-mode"
53 "--enable-mods-shared=all"
54 "--enable-mpms-shared=all"
58 "--includedir=${placeholder "dev"}/include"
59 (lib.enableFeature proxySupport "proxy")
60 (lib.enableFeature sslSupport "ssl")
61 (lib.enableFeature modTlsSupport "tls")
62 (lib.withFeatureAs libxml2Support "libxml2" "${libxml2.dev}/include/libxml2")
63 "--docdir=$(doc)/share/doc"
65 (lib.enableFeature brotliSupport "brotli")
66 (lib.withFeatureAs brotliSupport "brotli" brotli)
68 (lib.enableFeature http2Support "http2")
69 (lib.withFeature http2Support "nghttp2")
71 (lib.enableFeature luaSupport "lua")
72 (lib.withFeatureAs luaSupport "lua" lua5)
75 enableParallelBuilding = true;
77 stripDebugList = [ "lib" "modules" "bin" ];
80 mkdir -p $doc/share/doc/httpd
81 mv $out/manual $doc/share/doc/httpd
83 mv $out/bin/apxs $dev/bin/apxs
87 inherit apr aprutil sslSupport proxySupport ldapSupport luaSupport lua5;
89 acme-integration = nixosTests.acme;
90 proxy = nixosTests.proxy;
91 php = nixosTests.php.httpd;
96 description = "Apache HTTPD, the world's most popular web server";
97 homepage = "https://httpd.apache.org/";
98 license = licenses.asl20;
99 platforms = platforms.linux ++ platforms.darwin;
100 maintainers = with maintainers; [ lovek323 ];