2018-01-15 05:01:50 +01:00
|
|
|
{ stdenv, fetchFromGitHub, ocaml, findlib, ocamlbuild, topkg
|
2018-07-21 02:44:44 +02:00
|
|
|
, ppx_sexp_conv, result, x509, nocrypto, cstruct, ppx_cstruct, cstruct-unix, ounit
|
2016-11-03 01:23:53 +01:00
|
|
|
, lwt ? null}:
|
|
|
|
|
|
|
|
with stdenv.lib;
|
|
|
|
|
|
|
|
let withLwt = lwt != null; in
|
|
|
|
|
2018-07-05 21:40:30 +02:00
|
|
|
if !versionAtLeast ocaml.version "4.04"
|
|
|
|
then throw "tls is not available for OCaml ${ocaml.version}"
|
|
|
|
else
|
|
|
|
|
2018-01-15 05:01:50 +01:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
version = "0.9.0";
|
|
|
|
name = "ocaml${ocaml.version}-tls-${version}";
|
2016-11-03 01:23:53 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "mirleft";
|
|
|
|
repo = "ocaml-tls";
|
|
|
|
rev = "${version}";
|
2018-01-15 05:01:50 +01:00
|
|
|
sha256 = "0qgw8lq8pk9hss7b5i6fr08pi711i0zqx7yyjgcil47ipjig6c31";
|
2016-11-03 01:23:53 +01:00
|
|
|
};
|
|
|
|
|
2018-01-15 05:01:50 +01:00
|
|
|
buildInputs = [ ocaml ocamlbuild findlib topkg ppx_sexp_conv ounit ppx_cstruct cstruct-unix ];
|
2016-11-03 01:23:53 +01:00
|
|
|
propagatedBuildInputs = [ cstruct nocrypto result x509 ] ++
|
|
|
|
optional withLwt lwt;
|
|
|
|
|
2018-01-15 05:01:50 +01:00
|
|
|
buildPhase = "${topkg.run} build --tests true --with-mirage false --with-lwt ${if withLwt then "true" else "false"}";
|
2016-11-03 01:23:53 +01:00
|
|
|
|
|
|
|
doCheck = true;
|
2018-01-15 05:01:50 +01:00
|
|
|
checkPhase = "${topkg.run} test";
|
|
|
|
|
|
|
|
inherit (topkg) installPhase;
|
2016-11-03 01:23:53 +01:00
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
homepage = https://github.com/mirleft/ocaml-tls;
|
|
|
|
description = "TLS in pure OCaml";
|
|
|
|
license = licenses.bsd2;
|
|
|
|
maintainers = with maintainers; [ sternenseemann ];
|
|
|
|
};
|
|
|
|
}
|