1{ lib, stdenv
2, fetchFromGitHub
3, pkg-config
4, autoreconfHook
5, curl
6, lua
7, openssl
8, features ? {
9 urls = false;
10 # Upstream enables regex by default
11 regex = true;
12 # Signature support is broken with openssl 1.1.1: https://github.com/vstakhov/libucl/issues/203
13 signatures = false;
14 lua = false;
15 utils = false;
16 }
17}:
18
19let
20 featureDeps = {
21 urls = [ curl ];
22 signatures = [ openssl ];
23 lua = [ lua ];
24 };
25in
26stdenv.mkDerivation rec {
27 pname = "libucl";
28 version = "0.8.2";
29
30 src = fetchFromGitHub {
31 owner = "vstakhov";
32 repo = pname;
33 rev = version;
34 sha256 = "sha256-rpTc0gq8HquDow4NEkRSjyESEMrv8dAhX98yKKu/Fsk=";
35 };
36
37 nativeBuildInputs = [ pkg-config autoreconfHook ];
38
39 buildInputs = with lib;
40 concatLists (
41 mapAttrsToList (feat: enabled:
42 optionals enabled (featureDeps."${feat}" or [])
43 ) features
44 );
45
46 enableParallelBuilding = true;
47
48 configureFlags = with lib;
49 mapAttrsToList (feat: enabled: strings.enableFeature enabled feat) features;
50
51 meta = with lib; {
52 description = "Universal configuration library parser";
53 homepage = "https://github.com/vstakhov/libucl";
54 license = licenses.bsd2;
55 platforms = platforms.unix;
56 maintainers = with maintainers; [ jpotier ];
57 };
58}