evcc: 0.131.4 -> 0.131.5
[NixPkgs.git] / pkgs / development / ocaml-modules / mariadb / default.nix
blob3ac6027b22fd0d767ae030126bdea826c6738adb
1 { lib, fetchurl, stdenv
2 , fetchpatch
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";
11   version = "1.1.6";
13   src = fetchurl {
14     url = "https://github.com/andrenth/ocaml-mariadb/releases/download/${version}/ocaml-mariadb-${version}.tar.gz";
15     sha256 = "sha256-3/C1Gz6luUzS7oaudLlDHMT6JB2v5OdbLVzJhtayHGM=";
16   };
18   patches = lib.lists.map (x:
19     fetchpatch {
20       url = "https://github.com/andrenth/ocaml-mariadb/commit/${x.path}.patch";
21       inherit (x) hash;
22     })
23   [ { path = "9db2e4d8dec7c584213d0e0f03d079a36a35d9d5";
24       hash = "sha256-heROtU02cYBJ5edIHMdYP1xNXcLv8h79GYGBuudJhgE="; }
25     { path = "40cd3102bc7cce4ed826ed609464daeb1bbb4581";
26       hash = "sha256-YVsAMJiOgWRk9xPaRz2sDihBYLlXv+rhWtQIMOVLtSg="; }
27   ];
29   postPatch = ''
30     substituteInPlace setup.ml --replace '#use "topfind"' \
31       '#directory "${findlib}/lib/ocaml/${ocaml.version}/site-lib/";; #use "topfind"'
32   '';
34   nativeBuildInputs = [ ocaml findlib ocamlbuild ];
35   buildInputs = [ mariadb libmysqlclient camlp-streams ocamlbuild ];
36   propagatedBuildInputs = [ ctypes ];
38   strictDeps = true;
40   preInstall = "mkdir -p $OCAMLFIND_DESTDIR/stublibs";
42   meta = {
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;
48   };