buildDunePackage: new support function; use it to refactor some OCaml derivations

This commit is contained in:
Théo Zimmermann
2018-11-07 10:08:03 +01:00
parent 5fc73fd52e
commit 794158fcd5
64 changed files with 506 additions and 828 deletions
@@ -1,37 +1,26 @@
{ stdenv, fetchFromGitHub, ocaml, findlib, dune, alcotest, result
, bigstringaf
}:
{ stdenv, fetchFromGitHub, buildDunePackage, 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 {
buildDunePackage rec {
pname = "angstrom";
version = "0.10.0";
name = "ocaml${ocaml.version}-angstrom-${version}";
minimumOCamlVersion = "4.03";
src = fetchFromGitHub {
owner = "inhabitedtype";
repo = "angstrom";
rev = "${version}";
repo = pname;
rev = version;
sha256 = "0lh6024yf9ds0nh9i93r9m6p5psi8nvrqxl5x7jwl13zb0r9xfpw";
};
buildInputs = [ ocaml findlib dune alcotest ];
buildInputs = [ 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;
};
}