1{ stdenv, fetchFromGitHub, ocaml, ocamlbuild, findlib, topkg
2, ppx_tools, ppx_sexp_conv, cstruct, ppx_cstruct, sexplib, rresult, nocrypto
3, astring
4}:
5
6if !stdenv.lib.versionAtLeast ocaml.version "4.03"
7then throw "otr is not available for OCaml ${ocaml.version}"
8else
9
10stdenv.mkDerivation rec {
11 name = "ocaml${ocaml.version}-otr-${version}";
12 version = "0.3.4";
13
14 src = fetchFromGitHub {
15 owner = "hannesm";
16 repo = "ocaml-otr";
17 rev = "${version}";
18 sha256 = "0ixf0jvccmcbhk5mhzqakfzimvz200wkdkq3z2d0bdzyggslbdl4";
19 };
20
21 buildInputs = [ ocaml ocamlbuild findlib topkg ppx_tools ppx_sexp_conv ppx_cstruct ];
22 propagatedBuildInputs = [ cstruct sexplib rresult nocrypto astring ];
23
24 buildPhase = "${topkg.run} build --tests true";
25
26 inherit (topkg) installPhase;
27
28 doCheck = true;
29 checkPhase = "${topkg.run} test";
30
31 meta = with stdenv.lib; {
32 inherit (ocaml.meta) platforms;
33 homepage = https://github.com/hannesm/ocaml-otr;
34 description = "Off-the-record messaging protocol, purely in OCaml";
35 license = licenses.bsd2;
36 maintainers = with maintainers; [ sternenseemann ];
37 };
38}