stevenblack-blocklist: 3.15.5 -> 3.15.8 (#372042)
[NixPkgs.git] / pkgs / development / ocaml-modules / logs / default.nix
blob1eb99037686ba2af91c201794e3924768f13d035
2   lib,
3   stdenv,
4   fetchurl,
5   ocaml,
6   findlib,
7   ocamlbuild,
8   topkg,
9   result,
10   lwt,
11   cmdliner,
12   fmt,
13   fmtSupport ? lib.versionAtLeast ocaml.version "4.08",
14   js_of_ocaml,
15   jsooSupport ? true,
16   lwtSupport ? true,
17   cmdlinerSupport ? true,
19 let
20   pname = "logs";
21   webpage = "https://erratique.ch/software/${pname}";
23   optional_deps = [
24     {
25       pkg = js_of_ocaml;
26       enable_flag = "--with-js_of_ocaml";
27       enabled = jsooSupport;
28     }
29     {
30       pkg = fmt;
31       enable_flag = "--with-fmt";
32       enabled = fmtSupport;
33     }
34     {
35       pkg = lwt;
36       enable_flag = "--with-lwt";
37       enabled = lwtSupport;
38     }
39     {
40       pkg = cmdliner;
41       enable_flag = "--with-cmdliner";
42       enabled = cmdlinerSupport;
43     }
44   ];
45   enable_flags = lib.concatMap (d: [
46     d.enable_flag
47     (lib.boolToString d.enabled)
48   ]) optional_deps;
49   optional_buildInputs = map (d: d.pkg) (lib.filter (d: d.enabled) optional_deps);
52 if lib.versionOlder ocaml.version "4.03" then
53   throw "logs is not available for OCaml ${ocaml.version}"
54 else
56   stdenv.mkDerivation rec {
57     name = "ocaml${ocaml.version}-${pname}-${version}";
58     version = "0.7.0";
60     src = fetchurl {
61       url = "${webpage}/releases/${pname}-${version}.tbz";
62       sha256 = "1jnmd675wmsmdwyb5mx5b0ac66g4c6gpv5s4mrx2j6pb0wla1x46";
63     };
65     nativeBuildInputs = [
66       ocaml
67       findlib
68       ocamlbuild
69       topkg
70     ];
71     buildInputs = [ topkg ] ++ optional_buildInputs;
72     propagatedBuildInputs = [ result ];
74     strictDeps = true;
76     buildPhase = "${topkg.run} build ${lib.escapeShellArgs enable_flags}";
78     inherit (topkg) installPhase;
80     meta = with lib; {
81       description = "Logging infrastructure for OCaml";
82       homepage = webpage;
83       inherit (ocaml.meta) platforms;
84       maintainers = [ maintainers.sternenseemann ];
85       license = licenses.isc;
86     };
87   }