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