btrbk: add mainProgram (#356350)
[NixPkgs.git] / pkgs / by-name / li / lighttpd / package.nix
blobb169e5a83dab2263094bac024d751242f94a36d5
1 { lib, stdenv, buildPackages, fetchurl, pkg-config, pcre2, libxml2, zlib, bzip2, which, file
2 , autoreconfHook
3 , openssl
4 , enableDbi ? false, libdbi
5 , enableMagnet ? false, lua5_1
6 , enableMysql ? false, libmysqlclient
7 , enableLdap ? false, openldap
8 , enablePam ? false, linux-pam
9 , enableSasl ? false, cyrus_sasl
10 , enableWebDAV ? false, sqlite, libuuid
11 , enableExtendedAttrs ? false
12 , perl
13 , nixosTests
16 stdenv.mkDerivation rec {
17   pname = "lighttpd";
18   version = "1.4.76";
20   src = fetchurl {
21     url = "https://download.lighttpd.net/lighttpd/releases-${lib.versions.majorMinor version}.x/${pname}-${version}.tar.xz";
22     sha256 = "sha256-jL9CluNzz9DO3+nZeHYLWwXFj9xASLTivK8KYayPUBE=";
23   };
25   separateDebugInfo = true;
27   postPatch = ''
28     patchShebangs tests
29   '';
31   depsBuildBuild = [ buildPackages.stdenv.cc ];
33   nativeBuildInputs = [ autoreconfHook pkg-config ];
34   buildInputs = [ pcre2 pcre2.dev libxml2 zlib bzip2 which file openssl ]
35              ++ lib.optional enableDbi libdbi
36              ++ lib.optional enableMagnet lua5_1
37              ++ lib.optional enableMysql libmysqlclient
38              ++ lib.optional enableLdap openldap
39              ++ lib.optional enablePam linux-pam
40              ++ lib.optional enableSasl cyrus_sasl
41              ++ lib.optional enableWebDAV sqlite
42              ++ lib.optional enableWebDAV libuuid;
44   configureFlags = [ "--with-openssl" ]
45                 ++ lib.optional enableDbi "--with-dbi"
46                 ++ lib.optional enableMagnet "--with-lua"
47                 ++ lib.optional enableMysql "--with-mysql"
48                 ++ lib.optional enableLdap "--with-ldap"
49                 ++ lib.optional enablePam "--with-pam"
50                 ++ lib.optional enableSasl "--with-sasl"
51                 ++ lib.optional enableWebDAV "--with-webdav-props"
52                 ++ lib.optional enableWebDAV "--with-webdav-locks"
53                 ++ lib.optional enableExtendedAttrs "--with-attr";
55   preConfigure = ''
56     export PATH=$PATH:${pcre2.dev}/bin
57     sed -i "s:/usr/bin/file:${file}/bin/file:g" configure
58   '';
60   nativeCheckInputs = [ perl ];
61   doCheck = true;
63   postInstall = ''
64     mkdir -p "$out/share/lighttpd/doc/config"
65     cp -vr doc/config "$out/share/lighttpd/doc/"
66     # Remove files that references needless store paths (dependency bloat)
67     rm "$out/share/lighttpd/doc/config/Makefile"*
68     rm "$out/share/lighttpd/doc/config/conf.d/Makefile"*
69     rm "$out/share/lighttpd/doc/config/vhosts.d/Makefile"*
70   '';
72   passthru.tests = {
73     inherit (nixosTests) lighttpd;
74   };
76   meta = with lib; {
77     description = "Lightweight high-performance web server";
78     homepage = "http://www.lighttpd.net/";
79     license = lib.licenses.bsd3;
80     platforms = platforms.linux ++ platforms.darwin;
81     maintainers = with maintainers; [ bjornfor brecht ];
82     mainProgram = "lighttpd";
83   };