2022-01-27 16:11:20 +00:00
|
|
|
{ lib, stdenv, buildPackages, fetchurl, pkg-config, pcre2, libxml2, zlib, bzip2, which, file
|
2022-01-27 20:32:34 +00:00
|
|
|
, fetchpatch
|
2021-08-12 19:07:09 +00:00
|
|
|
, openssl
|
2021-08-15 19:13:52 +00:00
|
|
|
, enableDbi ? false, libdbi
|
|
|
|
, enableMagnet ? false, lua5_1
|
|
|
|
, enableMysql ? false, libmysqlclient
|
|
|
|
, enableLdap ? false, openldap
|
|
|
|
, enablePam ? false, linux-pam
|
|
|
|
, enableSasl ? false, cyrus_sasl
|
|
|
|
, enableWebDAV ? false, sqlite, libuuid
|
|
|
|
, enableExtendedAttrs ? false, attr
|
2018-08-08 21:29:43 +00:00
|
|
|
, perl
|
2022-07-25 08:13:50 +00:00
|
|
|
, nixosTests
|
2013-09-25 11:18:27 +00:00
|
|
|
}:
|
|
|
|
|
2013-11-17 22:06:25 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2021-05-23 15:07:31 +00:00
|
|
|
pname = "lighttpd";
|
2022-08-11 05:58:48 +00:00
|
|
|
version = "1.4.66";
|
2008-09-24 00:42:50 +00:00
|
|
|
|
2010-07-28 11:55:54 +00:00
|
|
|
src = fetchurl {
|
2021-05-23 15:07:31 +00:00
|
|
|
url = "https://download.lighttpd.net/lighttpd/releases-${lib.versions.majorMinor version}.x/${pname}-${version}.tar.xz";
|
2022-08-11 05:58:48 +00:00
|
|
|
sha256 = "sha256-R6xuYCcaoBluZUctAtAZVW3HxtCd87Zd8sGraGY0jjs=";
|
2008-09-24 00:42:50 +00:00
|
|
|
};
|
|
|
|
|
2018-08-08 21:29:43 +00:00
|
|
|
postPatch = ''
|
|
|
|
patchShebangs tests
|
2019-01-11 10:19:59 +00:00
|
|
|
# Linux sandbox has an empty hostname and not /etc/hosts, which fails some tests
|
|
|
|
sed -ire '/[$]self->{HOSTNAME} *=/i if(length($name)==0) { $name = "127.0.0.1" }' tests/LightyTest.pm
|
2022-01-15 20:36:36 +00:00
|
|
|
# it's difficult to prevent this test from trying to use /var/tmp (which
|
|
|
|
# the sandbox doesn't have) so until libredirect has support for mkstemp
|
|
|
|
# calls it's easiest to disable it
|
|
|
|
sed -i '/test_mod_ssi/d' src/t/test_mod.c
|
2018-08-08 21:29:43 +00:00
|
|
|
'';
|
|
|
|
|
2019-05-08 07:43:00 +00:00
|
|
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
|
|
|
|
2021-01-19 06:50:56 +00:00
|
|
|
nativeBuildInputs = [ pkg-config ];
|
2022-01-27 16:11:20 +00:00
|
|
|
buildInputs = [ pcre2 pcre2.dev libxml2 zlib bzip2 which file openssl ]
|
2021-08-12 19:07:09 +00:00
|
|
|
++ lib.optional enableDbi libdbi
|
2021-01-15 07:07:56 +00:00
|
|
|
++ lib.optional enableMagnet lua5_1
|
|
|
|
++ lib.optional enableMysql libmysqlclient
|
|
|
|
++ lib.optional enableLdap openldap
|
2021-08-12 19:07:09 +00:00
|
|
|
++ lib.optional enablePam linux-pam
|
|
|
|
++ lib.optional enableSasl cyrus_sasl
|
2021-01-15 07:07:56 +00:00
|
|
|
++ lib.optional enableWebDAV sqlite
|
|
|
|
++ lib.optional enableWebDAV libuuid;
|
2013-04-23 11:30:57 +00:00
|
|
|
|
2013-09-25 11:18:27 +00:00
|
|
|
configureFlags = [ "--with-openssl" ]
|
2021-08-12 19:07:09 +00:00
|
|
|
++ lib.optional enableDbi "--with-dbi"
|
2021-01-15 07:07:56 +00:00
|
|
|
++ lib.optional enableMagnet "--with-lua"
|
|
|
|
++ lib.optional enableMysql "--with-mysql"
|
|
|
|
++ lib.optional enableLdap "--with-ldap"
|
2021-08-12 19:07:09 +00:00
|
|
|
++ lib.optional enablePam "--with-pam"
|
|
|
|
++ lib.optional enableSasl "--with-sasl"
|
2021-01-15 07:07:56 +00:00
|
|
|
++ lib.optional enableWebDAV "--with-webdav-props"
|
|
|
|
++ lib.optional enableWebDAV "--with-webdav-locks"
|
|
|
|
++ lib.optional enableExtendedAttrs "--with-attr";
|
2013-04-01 13:28:05 +00:00
|
|
|
|
|
|
|
preConfigure = ''
|
2022-01-27 16:11:20 +00:00
|
|
|
export PATH=$PATH:${pcre2.dev}/bin
|
2013-04-01 13:28:05 +00:00
|
|
|
sed -i "s:/usr/bin/file:${file}/bin/file:g" configure
|
|
|
|
'';
|
2008-09-24 00:42:50 +00:00
|
|
|
|
2018-08-08 21:29:43 +00:00
|
|
|
checkInputs = [ perl ];
|
2019-01-06 10:05:30 +00:00
|
|
|
doCheck = true;
|
2018-08-08 21:29:43 +00:00
|
|
|
|
2017-04-23 17:20:43 +00:00
|
|
|
postInstall = ''
|
|
|
|
mkdir -p "$out/share/lighttpd/doc/config"
|
|
|
|
cp -vr doc/config "$out/share/lighttpd/doc/"
|
|
|
|
# Remove files that references needless store paths (dependency bloat)
|
|
|
|
rm "$out/share/lighttpd/doc/config/Makefile"*
|
|
|
|
rm "$out/share/lighttpd/doc/config/conf.d/Makefile"*
|
|
|
|
rm "$out/share/lighttpd/doc/config/vhosts.d/Makefile"*
|
|
|
|
'';
|
|
|
|
|
2022-07-25 08:13:50 +00:00
|
|
|
passthru.tests = {
|
|
|
|
inherit (nixosTests) lighttpd;
|
|
|
|
};
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2010-07-28 11:55:54 +00:00
|
|
|
description = "Lightweight high-performance web server";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "http://www.lighttpd.net/";
|
2021-01-15 07:07:56 +00:00
|
|
|
license = lib.licenses.bsd3;
|
2019-01-06 10:03:49 +00:00
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
2021-08-12 19:07:09 +00:00
|
|
|
maintainers = with maintainers; [ bjornfor brecht ];
|
2008-09-24 00:42:50 +00:00
|
|
|
};
|
|
|
|
}
|