2020-02-13 02:25:58 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, pkg-config, zlib, cmake, enableJemalloc ? !stdenv.hostPlatform.isMusl, jemalloc }:
|
2017-12-11 21:53:19 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "lwan";
|
2021-10-03 15:19:58 +00:00
|
|
|
version = "0.4";
|
2017-12-11 21:53:19 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "lpereira";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2021-10-03 15:19:58 +00:00
|
|
|
sha256 = "sha256-Z8kiuZHLEupCKFrj8guiu9fTG7s+5KiQ6x0pg9iMy0c=";
|
2017-12-11 21:53:19 +00:00
|
|
|
};
|
|
|
|
|
2021-01-19 06:50:56 +00:00
|
|
|
nativeBuildInputs = [ cmake pkg-config ];
|
2017-12-11 21:53:19 +00:00
|
|
|
|
2020-02-13 02:25:58 +00:00
|
|
|
buildInputs = [ zlib ] ++ lib.optional enableJemalloc jemalloc;
|
2017-12-11 21:53:19 +00:00
|
|
|
|
2022-03-21 16:14:40 +00:00
|
|
|
# Note: tcmalloc and mimalloc are also supported (and normal malloc)
|
2020-02-13 02:25:58 +00:00
|
|
|
cmakeFlags = lib.optional enableJemalloc "-DUSE_ALTERNATIVE_MALLOC=jemalloc";
|
2022-03-21 16:14:40 +00:00
|
|
|
|
2022-03-21 16:24:51 +00:00
|
|
|
hardeningDisable = lib.optional stdenv.hostPlatform.isMusl "pie";
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2017-12-11 21:53:19 +00:00
|
|
|
description = "Lightweight high-performance multi-threaded web server";
|
2024-03-19 02:14:51 +00:00
|
|
|
mainProgram = "lwan";
|
2017-12-11 21:53:19 +00:00
|
|
|
longDescription = "A lightweight and speedy web server with a low memory
|
|
|
|
footprint (~500KiB for 10k idle connections), with minimal system calls and
|
|
|
|
memory allocation. Lwan contains a hand-crafted HTTP request parser. Files are
|
|
|
|
served using the most efficient way according to their size: no copies between
|
|
|
|
kernel and userland for files larger than 16KiB. Smaller files are sent using
|
|
|
|
vectored I/O of memory-mapped buffers. Header overhead is considered before
|
|
|
|
compressing small files. Features include: mustache templating engine and IPv6
|
|
|
|
support.
|
|
|
|
";
|
|
|
|
homepage = "https://lwan.ws/";
|
2024-05-23 08:44:51 +00:00
|
|
|
license = licenses.gpl2Plus;
|
2017-12-11 21:53:19 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ leenaars ];
|
|
|
|
};
|
|
|
|
}
|