1{ lib, callPackage, stdenv, makeWrapper, fetchurl, ocaml, findlib, dune_3
2, ncurses
3, fix, menhir, menhirLib, menhirSdk, merlin-extend, ppxlib, utop, cppo, ppx_derivers
4, dune-build-info
5}:
6
7stdenv.mkDerivation rec {
8 pname = "ocaml${ocaml.version}-reason";
9 version = "3.10.0";
10
11 src = fetchurl {
12 url = "https://github.com/reasonml/reason/releases/download/${version}/reason-${version}.tbz";
13 hash = "sha256-F+rUwoZK9yc/VtCtYsRWS+Lq3nbT2oex04HtW0T0Zss=";
14 };
15
16 strictDeps = true;
17 nativeBuildInputs = [
18 makeWrapper
19 menhir
20 ocaml
21 menhir
22 cppo
23 dune_3
24 findlib
25 ];
26
27 buildInputs = [
28 dune-build-info
29 fix
30 menhirSdk
31 ppxlib
32 utop
33 ] ++ lib.optional (lib.versionOlder ocaml.version "4.07") ncurses;
34
35 propagatedBuildInputs = [
36 menhirLib
37 merlin-extend
38 ppx_derivers
39 ];
40
41 buildFlags = [ "build" ]; # do not "make tests" before reason lib is installed
42
43 installPhase = ''
44 runHook preInstall
45 dune install --prefix=$out --libdir=$OCAMLFIND_DESTDIR
46 wrapProgram $out/bin/rtop \
47 --prefix PATH : "${utop}/bin" \
48 --prefix CAML_LD_LIBRARY_PATH : "$CAML_LD_LIBRARY_PATH" \
49 --prefix OCAMLPATH : "$OCAMLPATH:$OCAMLFIND_DESTDIR"
50 runHook postInstall
51 '';
52
53 passthru.tests = {
54 hello = callPackage ./tests/hello { };
55 };
56
57 meta = with lib; {
58 homepage = "https://reasonml.github.io/";
59 downloadPage = "https://github.com/reasonml/reason";
60 description = "Facebook's friendly syntax to OCaml";
61 license = licenses.mit;
62 inherit (ocaml.meta) platforms;
63 maintainers = with maintainers; [ ];
64 };
65}