diff --git a/pkgs/development/ocaml-modules/estring/default.nix b/pkgs/development/ocaml-modules/estring/default.nix index c0c8eb51f71..9f04dac343c 100644 --- a/pkgs/development/ocaml-modules/estring/default.nix +++ b/pkgs/development/ocaml-modules/estring/default.nix @@ -1,4 +1,8 @@ -{ stdenv, buildOcaml, fetchurl }: +{ stdenv, buildOcaml, ocaml, fetchurl }: + +if stdenv.lib.versionAtLeast ocaml.version "4.06" +then throw "estring is not available for OCaml ${ocaml.version}" +else buildOcaml rec { name = "estring"; diff --git a/pkgs/development/ocaml-modules/sqlexpr/default.nix b/pkgs/development/ocaml-modules/sqlexpr/default.nix index 363d5850ec6..c7ed72dc523 100644 --- a/pkgs/development/ocaml-modules/sqlexpr/default.nix +++ b/pkgs/development/ocaml-modules/sqlexpr/default.nix @@ -1,19 +1,32 @@ -{ stdenv, buildOcaml, fetchurl, batteries, csv, ocaml_lwt, ocaml_sqlite3, estring }: +{ stdenv, fetchurl, ocaml, findlib, jbuilder, ocaml_lwt +, lwt_ppx, ocaml-migrate-parsetree, ppx_tools_versioned, csv, ocaml_sqlite3 +}: -buildOcaml rec { - name = "sqlexpr"; - version = "0.5.5"; +stdenv.mkDerivation rec { + version = "0.9.0"; + name = "ocaml${ocaml.version}-sqlexpr-${version}"; src = fetchurl { - url = "https://forge.ocamlcore.org/frs/download.php/1203/ocaml-sqlexpr-${version}.tar.gz"; - sha256 = "02pi0xxr3xzalwpvcaq96k57wz2vxj20l2mga1a4d2ddvhran8kr"; + url = "https://github.com/mfp/ocaml-sqlexpr/releases/download/${version}/ocaml-sqlexpr-${version}.tar.gz"; + sha256 = "0z0bkzi1mh0m39alzr2ds7hjpfxffx6azpfsj2wpaxrg64ks8ypd"; }; - propagatedBuildInputs = [ batteries csv ocaml_lwt ocaml_sqlite3 estring ]; + buildInputs = [ ocaml findlib jbuilder lwt_ppx ocaml-migrate-parsetree ppx_tools_versioned ]; - meta = with stdenv.lib; { - homepage = https://github.com/mfp/ocaml-sqlexpr; + propagatedBuildInputs = [ ocaml_lwt csv ocaml_sqlite3 ]; + + buildPhase = "dune build -p sqlexpr"; + + doCheck = true; + checkPhase = "dune runtest -p sqlexpr"; + + inherit (jbuilder) installPhase; + + meta = { description = "Type-safe, convenient SQLite database access"; - license = licenses.lgpl21; + homepage = "https://github.com/mfp/ocaml-sqlexpr"; + license = stdenv.lib.licenses.lgpl21; + maintainers = [ stdenv.lib.maintainers.vbgl ]; + inherit (ocaml.meta) platforms; }; } diff --git a/pkgs/development/ocaml-modules/sqlexpr/ppx.nix b/pkgs/development/ocaml-modules/sqlexpr/ppx.nix new file mode 100644 index 00000000000..c15378e8240 --- /dev/null +++ b/pkgs/development/ocaml-modules/sqlexpr/ppx.nix @@ -0,0 +1,15 @@ +{ stdenv, ocaml, findlib, jbuilder, sqlexpr, ounit +, ppx_core, ppx_tools_versioned, re, lwt_ppx +}: + +stdenv.mkDerivation rec { + name = "ocaml${ocaml.version}-ppx_sqlexpr-${version}"; + inherit (sqlexpr) version src installPhase meta; + + buildInputs = [ ocaml findlib jbuilder sqlexpr ounit ppx_core ppx_tools_versioned re lwt_ppx ]; + + buildPhase = "dune build -p ppx_sqlexpr"; + + doCheck = true; + checkPhase = "dune runtest -p ppx_sqlexpr"; +} diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix index 9bfb2f97c6e..003f21aa81a 100644 --- a/pkgs/top-level/ocaml-packages.nix +++ b/pkgs/top-level/ocaml-packages.nix @@ -644,6 +644,8 @@ let ppx_import = callPackage ../development/ocaml-modules/ppx_import {}; + ppx_sqlexpr = callPackage ../development/ocaml-modules/sqlexpr/ppx.nix {}; + ppx_tools = if lib.versionAtLeast ocaml.version "4.02" then callPackage ../development/ocaml-modules/ppx_tools {}