1{ stdenv, makeWrapper, buildOcaml, fetchFromGitHub,
2 ocaml, opam, jbuilder, menhir, merlin_extend, ppx_tools_versioned, utop }:
3
4buildOcaml rec {
5 name = "reason";
6 version = "3.0.4";
7
8 src = fetchFromGitHub {
9 owner = "facebook";
10 repo = "reason";
11 rev = version;
12 sha256 = "15qhx85him5rr4j0ygj3jh3qv9ijrn82ibr9scbn0qrnn43kj047";
13 };
14
15 propagatedBuildInputs = [ menhir merlin_extend ppx_tools_versioned ];
16
17 buildInputs = [ makeWrapper opam jbuilder utop menhir ];
18
19 buildFlags = [ "build" ]; # do not "make tests" before reason lib is installed
20
21 createFindlibDestdir = true;
22
23 postPatch = ''
24 substituteInPlace src/reasonbuild/myocamlbuild.ml \
25 --replace "refmt --print binary" "$out/bin/refmt --print binary"
26 '';
27
28 installPhase = ''
29 ${jbuilder.installPhase}
30
31 wrapProgram $out/bin/rtop \
32 --prefix PATH : "${utop}/bin" \
33 --set OCAMLPATH $out/lib/ocaml/${ocaml.version}/site-lib:$OCAMLPATH
34 '';
35
36 meta = with stdenv.lib; {
37 homepage = https://reasonml.github.io/;
38 description = "Facebook's friendly syntax to OCaml";
39 license = licenses.bsd3;
40 maintainers = [ maintainers.volth ];
41 };
42}