2024-07-27 06:49:29 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, fetchpatch, pkg-config, zlib, cmake, enableJemalloc ? !stdenv.hostPlatform.isMusl, jemalloc }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "lwan";
|
2024-07-27 06:49:29 +00:00
|
|
|
version = "0.5";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "lpereira";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2024-07-27 06:49:29 +00:00
|
|
|
sha256 = "sha256-otiPH+e+auMCyeOTq4LJYaBNv+I91kOCww7DCepQTAQ=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/lpereira/lwan/commit/9b94ff5eecec1e925103b25a43dacc226a634878.patch";
|
|
|
|
hash = "sha256-g1ZwmEodtF1fkbIBaLT4YvH8EG8DGafHydPSYJra+c0=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ cmake pkg-config ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
buildInputs = [ zlib ] ++ lib.optional enableJemalloc jemalloc;
|
|
|
|
|
|
|
|
# Note: tcmalloc and mimalloc are also supported (and normal malloc)
|
|
|
|
cmakeFlags = lib.optional enableJemalloc "-DUSE_ALTERNATIVE_MALLOC=jemalloc";
|
|
|
|
|
|
|
|
hardeningDisable = lib.optional stdenv.hostPlatform.isMusl "pie";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Lightweight high-performance multi-threaded web server";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "lwan";
|
2020-04-24 23:36:52 +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-06-05 15:53:02 +00:00
|
|
|
license = licenses.gpl2Plus;
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ leenaars ];
|
|
|
|
};
|
|
|
|
}
|