about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/libucl/default.nix
blob: b9b33453a4c6036f347074dc56c59d305b7d633b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{ stdenv
, fetchFromGitHub
, pkg-config
, autoreconfHook
, curl
, lua
, openssl
, features ? {
    urls = false;
    # Upstream enables regex by default
    regex = true;
    # Signature support is broken with openssl 1.1.1: https://github.com/vstakhov/libucl/issues/203
    signatures = false;
    lua = false;
    utils = false;
  }
}:

let
  featureDeps = {
    urls = [ curl ];
    signatures = [ openssl ];
    lua = [ lua ];
  };
in
stdenv.mkDerivation rec {
  pname = "libucl";
  version = "0.8.1";

  src = fetchFromGitHub {
    owner = "vstakhov";
    repo = pname;
    rev = version;
    sha256 = "1h52ldxankyhbbm1qbqz1f2q0j03c1b4mig7343bs3mc6fpm18gf";
  };

  nativeBuildInputs = [ pkg-config autoreconfHook ];

  buildInputs = with stdenv.lib;
    concatLists (
      mapAttrsToList (feat: enabled:
        optionals enabled (featureDeps."${feat}" or [])
      ) features
    );

  enableParallelBuilding = true;

  configureFlags = with stdenv.lib;
    mapAttrsToList (feat: enabled: strings.enableFeature enabled feat) features;

  meta = with stdenv.lib; {
    description = "Universal configuration library parser";
    homepage = "https://github.com/vstakhov/libucl";
    license = licenses.bsd2;
    platforms = platforms.unix;
    maintainers = with maintainers; [ jpotier ];
  };
}