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