Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ stdenv, fetchFromGitHub, cmake, jsoncpp, libossp_uuid, zlib, lib, fetchpatch
2# optional but of negligible size
3, openssl, brotli, c-ares
4# optional databases
5, sqliteSupport ? true, sqlite
6, postgresSupport ? false, postgresql
7, redisSupport ? false, hiredis
8, mysqlSupport ? false, libmysqlclient, mariadb }:
9
10stdenv.mkDerivation rec {
11 pname = "drogon";
12 version = "1.8.3";
13
14 src = fetchFromGitHub {
15 owner = "drogonframework";
16 repo = "drogon";
17 rev = "v${version}";
18 sha256 = "sha256-I3f/8TMGm1G4CFMJJLyiVYso9yTHjeLefS5eaGySvC4=";
19 fetchSubmodules = true;
20 };
21
22 nativeBuildInputs = [ cmake ];
23
24 cmakeFlags = [
25 "-DBUILD_TESTING=${if doInstallCheck then "ON" else "OFF"}"
26 "-DBUILD_EXAMPLES=OFF"
27 ];
28
29 propagatedBuildInputs = [
30 jsoncpp
31 libossp_uuid
32 zlib
33 openssl
34 brotli
35 c-ares
36 ] ++ lib.optional sqliteSupport sqlite
37 ++ lib.optional postgresSupport postgresql
38 ++ lib.optional redisSupport hiredis
39 # drogon uses mariadb for mysql (see https://github.com/drogonframework/drogon/wiki/ENG-02-Installation#Library-Dependencies)
40 ++ lib.optionals mysqlSupport [ libmysqlclient mariadb ];
41
42 patches = [
43 # this part of the test would normally fail because it attempts to configure a CMake project that uses find_package on itself
44 # this patch makes drogon and trantor visible to the test
45 ./fix_find_package.patch
46
47 # see https://github.com/drogonframework/drogon/issues/1491
48 (fetchpatch {
49 url = "https://github.com/drogonframework/drogon/commit/7d87d7e0b264ce53aa5ee006fb022d3516c9d666.patch";
50 sha256 = "sha256-C4zH9oNMfhkaeVNvZuBuzu1v2vNgg/t+YPitbrmHg+Y=";
51 })
52 ];
53
54 # modifying PATH here makes drogon_ctl visible to the test
55 installCheckPhase = ''
56 cd ..
57 PATH=$PATH:$out/bin bash test.sh
58 '';
59
60 doInstallCheck = true;
61
62 meta = with lib; {
63 homepage = "https://github.com/drogonframework/drogon";
64 description = "C++14/17 based HTTP web application framework";
65 license = licenses.mit;
66 maintainers = with maintainers; [ urlordjames ];
67 platforms = platforms.all;
68 };
69}