nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 fetchurl,
4 stdenv,
5 fetchpatch,
6 ocaml,
7 findlib,
8 ocamlbuild,
9 camlp-streams,
10 ctypes,
11 mariadb,
12 libmysqlclient,
13}:
14
15stdenv.mkDerivation rec {
16 pname = "ocaml${ocaml.version}-mariadb";
17 version = "1.1.6";
18
19 src = fetchurl {
20 url = "https://github.com/andrenth/ocaml-mariadb/releases/download/${version}/ocaml-mariadb-${version}.tar.gz";
21 sha256 = "sha256-3/C1Gz6luUzS7oaudLlDHMT6JB2v5OdbLVzJhtayHGM=";
22 };
23
24 patches =
25 lib.lists.map
26 (
27 x:
28 fetchpatch {
29 url = "https://github.com/andrenth/ocaml-mariadb/commit/${x.path}.patch";
30 inherit (x) hash;
31 }
32 )
33 [
34 {
35 path = "9db2e4d8dec7c584213d0e0f03d079a36a35d9d5";
36 hash = "sha256-heROtU02cYBJ5edIHMdYP1xNXcLv8h79GYGBuudJhgE=";
37 }
38 {
39 path = "40cd3102bc7cce4ed826ed609464daeb1bbb4581";
40 hash = "sha256-YVsAMJiOgWRk9xPaRz2sDihBYLlXv+rhWtQIMOVLtSg=";
41 }
42 ];
43
44 postPatch = ''
45 substituteInPlace setup.ml --replace '#use "topfind"' \
46 '#directory "${findlib}/lib/ocaml/${ocaml.version}/site-lib/";; #use "topfind"'
47 '';
48
49 nativeBuildInputs = [
50 ocaml
51 findlib
52 ocamlbuild
53 ];
54 buildInputs = [
55 mariadb
56 libmysqlclient
57 camlp-streams
58 ocamlbuild
59 ];
60 propagatedBuildInputs = [ ctypes ];
61
62 strictDeps = true;
63
64 preInstall = "mkdir -p $OCAMLFIND_DESTDIR/stublibs";
65
66 meta = {
67 description = "OCaml bindings for MariaDB";
68 license = lib.licenses.mit;
69 maintainers = with lib.maintainers; [ bcc32 ];
70 homepage = "https://github.com/andrenth/ocaml-mariadb";
71 inherit (ocaml.meta) platforms;
72 broken = !(lib.versionAtLeast ocaml.version "4.07");
73 };
74}