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,28 +1,19 @@
{ stdenv, fetchFromGitHub, ocaml, dune, findlib, defaultVersion ? "0.11.0" }:
{ stdenv, fetchFromGitHub, buildDunePackage, defaultVersion ? "0.11.0" }:
{ name, version ? defaultVersion, buildInputs ? [], hash, meta, ...}@args:
{ pname, version ? defaultVersion, hash, ...}@args:
if !stdenv.lib.versionAtLeast ocaml.version "4.04"
then throw "${name}-${version} is not available for OCaml ${ocaml.version}" else
stdenv.mkDerivation (args // {
name = "ocaml${ocaml.version}-${name}-${version}";
buildDunePackage (args // {
inherit version;
minimumOCamlVersion = "4.04";
src = fetchFromGitHub {
owner = "janestreet";
repo = name;
repo = pname;
rev = "v${version}";
sha256 = hash;
};
buildInputs = [ ocaml dune findlib ] ++ buildInputs;
inherit (dune) installPhase;
meta = {
license = stdenv.lib.licenses.asl20;
inherit (ocaml.meta) platforms;
homepage = "https://github.com/janestreet/${name}";
} // meta;
meta.license = stdenv.lib.licenses.asl20;
meta.homepage = "https://github.com/janestreet/${pname}";
})