nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, stdenv
3, fetchurl
4, bmake
5, groff
6, inetutils
7, wget
8, openssl
9, libxcrypt
10, minimal ? false
11, userSupport ? !minimal
12, cgiSupport ? !minimal
13, dirIndexSupport ? !minimal
14, dynamicContentSupport ? !minimal
15, sslSupport ? !minimal
16, luaSupport ? !minimal
17, lua
18, htpasswdSupport ? !minimal
19}:
20
21let inherit (lib) optional optionals;
22in
23stdenv.mkDerivation rec {
24 pname = "bozohttpd";
25 version = "20220517";
26
27 # bozohttpd is developed in-tree in pkgsrc, canonical hashes can be found at:
28 # http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/www/bozohttpd/distinfo
29 src = fetchurl {
30 url = "http://www.eterna.com.au/${pname}/${pname}-${version}.tar.bz2";
31 sha512 = "275b8fab3cf2e6c59721682cae952db95da5bd3b1f20680240c6cf1029463693f6feca047fbef5e3a3e7528b40b7b2e87b2a56fd800b612e679a16f24890e5b6";
32 };
33
34 buildInputs = [ openssl libxcrypt ] ++ optional (luaSupport) lua;
35 nativeBuildInputs = [ bmake groff ];
36
37 COPTS = [
38 "-D_DEFAULT_SOURCE"
39 "-D_GNU_SOURCE"
40
41 # ensure that we can serve >2GB files even on 32-bit systems.
42 "-D_LARGEFILE_SOURCE"
43 "-D_FILE_OFFSET_BITS=64"
44
45 # unpackaged dependency: https://man.netbsd.org/blocklist.3
46 "-DNO_BLOCKLIST_SUPPORT"
47 ]
48 ++ optional (!userSupport) "-DNO_USER_SUPPORT"
49 ++ optional (!dirIndexSupport) "-DNO_DIRINDEX_SUPPORT"
50 ++ optional (!dynamicContentSupport) "-DNO_DYNAMIC_CONTENT"
51 ++ optional (!luaSupport) "-DNO_LUA_SUPPORT"
52 ++ optional (!sslSupport) "-DNO_SSL_SUPPORT"
53 ++ optional (!cgiSupport) "-DNO_CGIBIN_SUPPORT"
54 ++ optional (htpasswdSupport) "-DDO_HTPASSWD";
55
56 _LDADD = [ "-lm" ]
57 ++ optional (stdenv.hostPlatform.libc != "libSystem") "-lcrypt"
58 ++ optional (luaSupport) "-llua"
59 ++ optionals (sslSupport) [ "-lssl" "-lcrypto" ];
60 makeFlags = [ "LDADD=$(_LDADD)" ];
61
62 doCheck = true;
63 nativeCheckInputs = [ inetutils wget ];
64 checkFlags = optional (!cgiSupport) "CGITESTS=";
65
66 meta = with lib; {
67 description = "Bozotic HTTP server; small and secure";
68 longDescription = ''
69 bozohttpd is a small and secure HTTP version 1.1 server. Its main
70 feature is the lack of features, reducing the code size and improving
71 verifiability.
72
73 It supports CGI/1.1, HTTP/1.1, HTTP/1.0, HTTP/0.9, ~user translations,
74 virtual hosting support, as well as multiple IP-based servers on a
75 single machine. It is capable of servicing pages via the IPv6 protocol.
76 It has SSL support. It has no configuration file by design.
77 '';
78 homepage = "http://www.eterna.com.au/bozohttpd/";
79 changelog = "http://www.eterna.com.au/bozohttpd/CHANGES";
80 license = licenses.bsd2;
81 maintainers = [ maintainers.embr ];
82 platforms = platforms.all;
83 };
84}