nixpkgs-suyu/pkgs/development/ocaml-modules/janestreet/janePackage.nix
2018-03-06 23:26:12 +09:00

28 lines
771 B
Nix

{ stdenv, fetchFromGitHub, ocaml, jbuilder, findlib, defaultVersion ? "0.10.0" }:
{ name, version ? defaultVersion, buildInputs ? [], hash, meta, ...}@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}";
inherit version;
src = fetchFromGitHub {
owner = "janestreet";
repo = name;
rev = "v${version}";
sha256 = hash;
};
buildInputs = [ ocaml jbuilder findlib ] ++ buildInputs;
inherit (jbuilder) installPhase;
meta = {
license = stdenv.lib.licenses.asl20;
inherit (ocaml.meta) platforms;
homepage = "https://github.com/janestreet/${name}";
} // meta;
})