summary refs log tree commit diff
path: root/pkgs/development/ocaml-modules/janestreet/janePackage.nix
blob: 439c6f500bc95df7496cf8e905008b75b39f779c (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
{ stdenv, fetchFromGitHub, ocaml, dune, findlib, defaultVersion ? "0.11.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 dune findlib ] ++ buildInputs;

  inherit (dune) installPhase;

  meta = {
    license = stdenv.lib.licenses.asl20;
    inherit (ocaml.meta) platforms;
    homepage = "https://github.com/janestreet/${name}";
  } // meta;
})