@@ -1,38 +1,26 @@
1−{ stdenv, fetchFromGitHub, ocaml, findlib, ocamlbuild, topkg
2−, ppx_sexp_conv, result, x509, nocrypto, cstruct-sexp, ppx_cstruct, cstruct-unix, ounit
3−, lwt ? null}:
1+{ stdenv, fetchurl, buildDunePackage, ppx_sexp_conv, ppx_cstruct, cstruct
2+, cstruct-sexp, sexplib, mirage-crypto, mirage-crypto-pk, mirage-crypto-rng
3+, x509, domain-name, fmt, cstruct-unix, ounit2, ocaml_lwt, ptime }:
44
5−with stdenv.lib;
5+buildDunePackage rec {
6+ minimumOCamlVersion = "4.07";
67
7−let withLwt = lwt != null; in
8+ version = "0.11.1";
9+ pname = "tls";
810
9−if !versionAtLeast ocaml.version "4.04"
10−then throw "tls is not available for OCaml ${ocaml.version}"
11−else
12−
13−stdenv.mkDerivation rec {
14− version = "0.10.4";
15− name = "ocaml${ocaml.version}-tls-${version}";
16−
17− src = fetchFromGitHub {
18− owner = "mirleft";
19− repo = "ocaml-tls";
20− rev = version;
21− sha256 = "02wv4lia583imn3sfci4nqv6ac5nzig5j3yfdnlqa0q8bp9rfc6g";
11+ src = fetchurl {
12+ url = "https://github.com/mirleft/ocaml-tls/releases/download/v${version}/tls-v${version}.tbz";
13+ sha256 = "0ms13fbaxgmpbviazlfa4hb7nmi7s22nklc7ns926b0rr1aq1069";
2214 };
2315
24− nativeBuildInputs = [ ocaml ocamlbuild findlib ];
25− buildInputs = [ findlib topkg ppx_sexp_conv ppx_cstruct ]
26− ++ optionals doCheck [ ounit cstruct-unix ];
27− propagatedBuildInputs = [ cstruct-sexp nocrypto result x509 ] ++
28− optional withLwt lwt;
29−
30− buildPhase = "${topkg.run} build --tests ${boolToString doCheck} --with-mirage false --with-lwt ${boolToString withLwt}";
16+ useDune2 = true;
3117
32− doCheck = versionAtLeast ocaml.version "4.06";
33− checkPhase = "${topkg.run} test";
18+ doCheck = true;
19+ buildInputs = [ cstruct-unix ounit2 ];
3420
35− inherit (topkg) installPhase;
21+ propagatedBuildInputs = [ ppx_sexp_conv ppx_cstruct cstruct cstruct-sexp
22+ sexplib mirage-crypto mirage-crypto-pk mirage-crypto-rng
23+ x509 domain-name fmt ocaml_lwt ptime ];
3624
3725 meta = with stdenv.lib; {
3826 homepage = "https://github.com/mirleft/ocaml-tls";