nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5
6 withJson ? true,
7 withHttps ? true,
8 withWebsockets ? true,
9 withCurl ? true,
10 withLogger ? true,
11 withUwsc ? withWebsockets, # uwsc depends on websockets
12
13 # nativeBuildInputs
14 cmake,
15
16 # Optional dependencies
17 curl,
18 gnutls,
19 jansson,
20 libmicrohttpd,
21 orcania,
22 yder,
23 zlib,
24}:
25
26stdenv.mkDerivation (finalAttrs: {
27 pname = "ulfius";
28 version = "2.7.15";
29
30 src = fetchFromGitHub {
31 owner = "babelouest";
32 repo = "ulfius";
33 tag = "v${finalAttrs.version}";
34 hash = "sha256-YvMhcobvTEm4LxhNxi1MJX8N7VAB3YOvp+LxioJrKHU=";
35 };
36
37 strictDeps = true;
38
39 nativeBuildInputs = [
40 cmake
41 ];
42
43 propagatedBuildInputs = [
44 libmicrohttpd
45 orcania
46 ]
47 ++ lib.optionals withJson [ jansson ]
48 ++ lib.optionals withCurl [ curl ]
49 ++ lib.optionals (withHttps || withWebsockets) [ gnutls ]
50 ++ lib.optionals withLogger [ yder ]
51 ++ lib.optionals withWebsockets [ zlib ];
52
53 cmakeFlags = [
54 (lib.cmakeBool "WITH_CURL" withCurl)
55 (lib.cmakeBool "WITH_JANSSON" withJson)
56 (lib.cmakeBool "WITH_GNUTLS" (withHttps || withWebsockets))
57 (lib.cmakeBool "WITH_YDER" withLogger)
58 (lib.cmakeBool "BUILD_UWSC" (withUwsc && withWebsockets))
59 (lib.cmakeBool "WITH_WEBSOCKET" withWebsockets)
60 (lib.cmakeBool "WITH_WEBSOCKET_MESSAGE_LIST" withWebsockets)
61 ];
62
63 meta = {
64 description = "Web Framework to build REST APIs, Webservices or any HTTP endpoint in C language. Can stream large amount of data, integrate JSON data with Jansson, and create websocket services";
65 homepage = "https://github.com/babelouest/ulfius";
66 changelog = "https://github.com/babelouest/ulfius/blob/${finalAttrs.src.tag}/CHANGELOG.md";
67 license = lib.licenses.lgpl21Only;
68 maintainers = with lib.maintainers; [ drupol ];
69 platforms = lib.platforms.all;
70 }
71 // lib.optionalAttrs (withUwsc && withWebsockets) { mainProgram = "uwsc"; };
72})