2018-09-05 18:11:47 +02:00
|
|
|
{ stdenv, fetchFromGitHub, ocaml, dune, findlib, defaultVersion ? "0.11.0" }:
|
2017-05-10 11:20:47 +02:00
|
|
|
|
2018-03-06 15:26:12 +01:00
|
|
|
{ name, version ? defaultVersion, buildInputs ? [], hash, meta, ...}@args:
|
2017-05-10 11:20:47 +02:00
|
|
|
|
2018-03-03 12:39:17 +01:00
|
|
|
if !stdenv.lib.versionAtLeast ocaml.version "4.04"
|
2017-05-10 11:20:47 +02:00
|
|
|
then throw "${name}-${version} is not available for OCaml ${ocaml.version}" else
|
|
|
|
|
|
|
|
stdenv.mkDerivation (args // {
|
|
|
|
name = "ocaml${ocaml.version}-${name}-${version}";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "janestreet";
|
|
|
|
repo = name;
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = hash;
|
|
|
|
};
|
|
|
|
|
2018-09-05 18:11:47 +02:00
|
|
|
buildInputs = [ ocaml dune findlib ] ++ buildInputs;
|
2017-05-10 11:20:47 +02:00
|
|
|
|
2018-09-05 18:11:47 +02:00
|
|
|
inherit (dune) installPhase;
|
2017-05-10 11:20:47 +02:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
license = stdenv.lib.licenses.asl20;
|
|
|
|
inherit (ocaml.meta) platforms;
|
|
|
|
homepage = "https://github.com/janestreet/${name}";
|
|
|
|
} // meta;
|
|
|
|
})
|