python312Packages.icontract: relax deps (#380554)
[NixPkgs.git] / pkgs / by-name / hi / hiawatha / package.nix
blob9ff18400619a62c26b9f8fb2a55a50a5ea26abad
2   lib,
3   stdenv,
4   fetchFromGitLab,
5   callPackage,
7   cmake,
8   ninja,
9   mbedtls,
10   libxcrypt,
11   zlib,
13   enableCache ? true, # Internal cache support.
14   enableIpV6 ? true,
15   enableTls ? true,
16   enableMonitor ? false, # Support for the Hiawatha Monitor.
17   enableRproxy ? true, # Reverse proxy support.
18   enableTomahawk ? false, # Tomahawk, the Hiawatha command shell.
19   enableXslt ? true,
20   libxml2 ? null,
21   libxslt ? null,
22   enableToolkit ? true, # The URL Toolkit.
25 stdenv.mkDerivation (finalAttrs: {
26   pname = "hiawatha";
27   version = "11.6";
29   src = fetchFromGitLab {
30     owner = "hsleisink";
31     repo = "hiawatha";
32     rev = "v${finalAttrs.version}";
33     hash = "sha256-YsZdVqanVNibA4KnAknLh61hVo7x5uu67lb+RX2N7c8=";
34   };
36   nativeBuildInputs = [
37     cmake
38     ninja
39   ];
40   buildInputs =
41     [
42       mbedtls
43       libxcrypt
44       zlib
45     ]
46     ++ lib.optionals enableXslt [
47       libxslt
48       libxml2
49     ];
51   prePatch = ''
52     substituteInPlace CMakeLists.txt --replace SETUID ""
53   '';
55   cmakeFlags = [
56     "-DUSE_SYSTEM_MBEDTLS=on" # Policy to use Nix deps, and Nix uses up to date deps
57     (if enableCache then "-DENABLE_CACHE=on" else "-DENABLE_CACHE=off")
58     (if enableIpV6 then "-DENABLE_IPV6=on" else "-DENABLE_IPV6=off")
59     (if enableTls then "-DENABLE_TLS=on" else "-DENABLE_TLS=off")
60     (if enableMonitor then "-DENABLE_MONITOR=on" else "-DENABLE_MONITOR=off")
61     (if enableRproxy then "-DENABLE_RPROXY=on" else "-DENABLE_RPROXY=off")
62     (if enableTomahawk then "-DENABLE_TOMAHAWK=on" else "-DENABLE_TOMAHAWK=off")
63     (if enableXslt then "-DENABLE_XSLT=on" else "-DENABLE_XSLT=off")
64     (if enableToolkit then "-DENABLE_TOOLKIT=on" else "-DENABLE_TOOLKIT=off")
65   ];
67   passthru.tests.serve-static-files = callPackage ./test.nix {
68     hiawatha = finalAttrs.finalPackage;
69     inherit enableTls;
70   };
72   meta = with lib; {
73     homepage = "https://hiawatha.leisink.net/";
74     description = "Advanced and secure webserver";
75     license = licenses.gpl2Only;
76     platforms = platforms.unix; # "Hiawatha runs perfectly on Linux, BSD and MacOS X"
77     mainProgram = "hiawatha";
78     maintainers = [ ];
79   };