summary refs log tree commit diff
path: root/pkgs/development/ocaml-modules/angstrom/default.nix
blob: 0c00dc2ff24e10c9ab6c43f9d7a5c9f66119c970 (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
36
37
{ stdenv, fetchFromGitHub, ocaml, findlib, dune, alcotest, result
, bigstringaf
}:

if !stdenv.lib.versionAtLeast ocaml.version "4.03"
then throw "angstrom is not available for OCaml ${ocaml.version}"
else

stdenv.mkDerivation rec {
  version = "0.10.0";
  name = "ocaml${ocaml.version}-angstrom-${version}";

  src = fetchFromGitHub {
    owner  = "inhabitedtype";
    repo   = "angstrom";
    rev    = "${version}";
    sha256 = "0lh6024yf9ds0nh9i93r9m6p5psi8nvrqxl5x7jwl13zb0r9xfpw";
  };

  buildInputs = [ ocaml findlib dune alcotest ];
  propagatedBuildInputs = [ bigstringaf result ];

  buildPhase = "dune build -p angstrom";

  doCheck = true;
  checkPhase = "dune runtest -p angstrom";

  inherit (dune) installPhase;

  meta = {
    homepage = https://github.com/inhabitedtype/angstrom;
    description = "OCaml parser combinators built for speed and memory efficiency";
    license = stdenv.lib.licenses.bsd3;
    maintainers = with stdenv.lib.maintainers; [ sternenseemann ];
    inherit (ocaml.meta) platforms;
  };
}