1{
2 lib,
3 callPackage,
4 buildDunePackage,
5 fetchurl,
6 fix,
7 menhir,
8 menhirLib,
9 menhirSdk,
10 merlin-extend,
11 ppxlib,
12 cppo,
13 cmdliner,
14 dune-build-info,
15}:
16
17let
18 param =
19 if lib.versionAtLeast ppxlib.version "0.36" then
20 {
21 version = "3.17.0";
22 hash = "sha256-gsiBnOn9IVt+fixlAeY456kE6+E6taHY6sJnnYz4pes=";
23 }
24 else
25 {
26 version = "3.15.0";
27
28 hash = "sha256-7D0gJfQ5Hw0riNIFPmJ6haoa3dnFEyDp5yxpDgX7ZqY=";
29 };
30in
31
32buildDunePackage rec {
33 pname = "reason";
34 inherit (param) version;
35
36 minimalOCamlVersion = "4.11";
37
38 src = fetchurl {
39 url = "https://github.com/reasonml/reason/releases/download/${version}/reason-${version}.tbz";
40 inherit (param) hash;
41 };
42
43 nativeBuildInputs = [
44 menhir
45 cppo
46 ];
47
48 buildInputs = [
49 dune-build-info
50 fix
51 menhirSdk
52 merlin-extend
53 ]
54 ++ lib.optional (lib.versionAtLeast version "3.17") cmdliner;
55
56 propagatedBuildInputs = [
57 ppxlib
58 menhirLib
59 ];
60
61 passthru.tests = {
62 hello = callPackage ./tests/hello { };
63 };
64
65 meta = with lib; {
66 homepage = "https://reasonml.github.io/";
67 downloadPage = "https://github.com/reasonml/reason";
68 description = "User-friendly programming language built on OCaml";
69 license = licenses.mit;
70 maintainers = [ ];
71 };
72}