1 { lib, fetchurl, stdenv
3 , ocaml, findlib, ocamlbuild, camlp-streams
4 , ctypes, mariadb, libmysqlclient }:
6 lib.throwIfNot (lib.versionAtLeast ocaml.version "4.07")
7 "mariadb is not available for OCaml ${ocaml.version}"
9 stdenv.mkDerivation rec {
10 pname = "ocaml${ocaml.version}-mariadb";
14 url = "https://github.com/andrenth/ocaml-mariadb/releases/download/${version}/ocaml-mariadb-${version}.tar.gz";
15 sha256 = "sha256-3/C1Gz6luUzS7oaudLlDHMT6JB2v5OdbLVzJhtayHGM=";
18 patches = lib.lists.map (x:
20 url = "https://github.com/andrenth/ocaml-mariadb/commit/${x.path}.patch";
23 [ { path = "9db2e4d8dec7c584213d0e0f03d079a36a35d9d5";
24 hash = "sha256-heROtU02cYBJ5edIHMdYP1xNXcLv8h79GYGBuudJhgE="; }
25 { path = "40cd3102bc7cce4ed826ed609464daeb1bbb4581";
26 hash = "sha256-YVsAMJiOgWRk9xPaRz2sDihBYLlXv+rhWtQIMOVLtSg="; }
30 substituteInPlace setup.ml --replace '#use "topfind"' \
31 '#directory "${findlib}/lib/ocaml/${ocaml.version}/site-lib/";; #use "topfind"'
34 nativeBuildInputs = [ ocaml findlib ocamlbuild ];
35 buildInputs = [ mariadb libmysqlclient camlp-streams ocamlbuild ];
36 propagatedBuildInputs = [ ctypes ];
40 preInstall = "mkdir -p $OCAMLFIND_DESTDIR/stublibs";
43 description = "OCaml bindings for MariaDB";
44 license = lib.licenses.mit;
45 maintainers = with lib.maintainers; [ bcc32 ];
46 homepage = "https://github.com/andrenth/ocaml-mariadb";
47 inherit (ocaml.meta) platforms;