13 fmtSupport ? lib.versionAtLeast ocaml.version "4.08",
17 cmdlinerSupport ? true,
21 webpage = "https://erratique.ch/software/${pname}";
26 enable_flag = "--with-js_of_ocaml";
27 enabled = jsooSupport;
31 enable_flag = "--with-fmt";
36 enable_flag = "--with-lwt";
41 enable_flag = "--with-cmdliner";
42 enabled = cmdlinerSupport;
45 enable_flags = lib.concatMap (d: [
47 (lib.boolToString d.enabled)
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}"
56 stdenv.mkDerivation rec {
57 name = "ocaml${ocaml.version}-${pname}-${version}";
61 url = "${webpage}/releases/${pname}-${version}.tbz";
62 sha256 = "1jnmd675wmsmdwyb5mx5b0ac66g4c6gpv5s4mrx2j6pb0wla1x46";
71 buildInputs = [ topkg ] ++ optional_buildInputs;
72 propagatedBuildInputs = [ result ];
76 buildPhase = "${topkg.run} build ${lib.escapeShellArgs enable_flags}";
78 inherit (topkg) installPhase;
81 description = "Logging infrastructure for OCaml";
83 inherit (ocaml.meta) platforms;
84 maintainers = [ maintainers.sternenseemann ];
85 license = licenses.isc;