1 { lib, stdenv, fetchFromGitHub, pkg-config, zlib, cmake, enableJemalloc ? !stdenv.hostPlatform.isMusl, jemalloc }:
3 stdenv.mkDerivation rec {
7 src = fetchFromGitHub {
11 sha256 = "sha256-Z8kiuZHLEupCKFrj8guiu9fTG7s+5KiQ6x0pg9iMy0c=";
14 nativeBuildInputs = [ cmake pkg-config ];
16 buildInputs = [ zlib ] ++ lib.optional enableJemalloc jemalloc;
18 # Note: tcmalloc and mimalloc are also supported (and normal malloc)
19 cmakeFlags = lib.optional enableJemalloc "-DUSE_ALTERNATIVE_MALLOC=jemalloc";
21 hardeningDisable = lib.optional stdenv.hostPlatform.isMusl "pie";
24 description = "Lightweight high-performance multi-threaded web server";
26 longDescription = "A lightweight and speedy web server with a low memory
27 footprint (~500KiB for 10k idle connections), with minimal system calls and
28 memory allocation. Lwan contains a hand-crafted HTTP request parser. Files are
29 served using the most efficient way according to their size: no copies between
30 kernel and userland for files larger than 16KiB. Smaller files are sent using
31 vectored I/O of memory-mapped buffers. Header overhead is considered before
32 compressing small files. Features include: mustache templating engine and IPv6
35 homepage = "https://lwan.ws/";
36 license = licenses.gpl2;
37 platforms = platforms.linux;
38 maintainers = with maintainers; [ leenaars ];