1{
2 lib,
3 fetchFromGitHub,
4 buildDunePackage,
5 lua5_1,
6 pkg-config,
7}:
8
9buildDunePackage {
10 pname = "ocaml-lua";
11 version = "1.8";
12
13 minimalOCamlVersion = "4.08";
14
15 src = fetchFromGitHub {
16 owner = "pdonadeo";
17 repo = "ocaml-lua";
18 # Take the latest commit, as some warnings have been fixed/suppressed
19 rev = "f44ad50c88bf999f48a13af663051493c89d7d02";
20 hash = "sha256-AXtKrty8JdI+yc+Y9EiufBbySlr49OyXW6wKwmDb0xo=";
21 };
22
23 # ocaml-lua vendors and builds Lua: replace that with the one from nixpkgs
24 postPatch = ''
25 rm -r src/lua_c
26 substituteInPlace src/dune \
27 --replace "-Ilua_c/lua515/src" "" \
28 --replace "(libraries unix threads lua_c)" \
29 "(libraries unix threads) (c_library_flags -llua)"
30 '';
31
32 nativeBuildInputs = [ pkg-config ];
33 buildInputs = [ lua5_1 ];
34
35 doCheck = true;
36
37 meta = {
38 description = "Lua bindings for OCaml";
39 homepage = "https://pdonadeo.github.io/ocaml-lua";
40 license = lib.licenses.mit;
41 maintainers = [ lib.maintainers.kenran ];
42 };
43}