about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/ocaml-modules/lua-ml/default.nix
blob: 8a4f58ccbbd79aaf08e98c5e20104f31f624bc16 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{ stdenv, lib, fetchFromGitHub, ocaml, findlib, ocamlbuild, opaline }:

if !lib.versionAtLeast ocaml.version "4.07"
then throw "lua-ml is not available for OCaml ${ocaml.version}"
else

stdenv.mkDerivation rec {
  pname = "lua-ml";
  name = "ocaml${ocaml.version}-${pname}-${version}";
  version = "0.9.1";

  src = fetchFromGitHub {
    owner = "lindig";
    repo = pname;
    rev = version;
    sha256 = "04lv98nxmzanvyn4c0k6k0ax29f5xfdl8qzpf5hwadslq213a044";
  };

  nativeBuildInputs = [ opaline ];
  buildInputs = [ ocaml findlib ocamlbuild ];

  buildFlags = [ "lib" ];

  installPhase = ''
    opaline -prefix $out -libdir $OCAMLFIND_DESTDIR
  '';

  meta = {
    description = "An embeddable Lua 2.5 interpreter implemented in OCaml";
    inherit (src.meta) homepage;
    inherit (ocaml.meta) platforms;
    license = lib.licenses.bsd2;
    maintainers = [ lib.maintainers.vbgl ];
  };
}