diff --git a/pkgs/development/compilers/reason/default.nix b/pkgs/development/compilers/reason/default.nix index a65748d0642..dbc6f40a68c 100644 --- a/pkgs/development/compilers/reason/default.nix +++ b/pkgs/development/compilers/reason/default.nix @@ -1,5 +1,5 @@ -{ lib, stdenv, makeWrapper, fetchFromGitHub, ocaml, findlib, dune_2 -, fix, menhir, menhirLib, menhirSdk, merlin-extend, ppx_tools_versioned, utop, cppo +{ lib, callPackage, stdenv, makeWrapper, fetchFromGitHub, ocaml, findlib, dune_2 +, fix, menhir, menhirLib, menhirSdk, merlin-extend, ppxlib, utop, cppo, ppx_derivers }: stdenv.mkDerivation rec { @@ -13,11 +13,28 @@ stdenv.mkDerivation rec { sha256 = "0m6ldrci1a4j0qv1cbwh770zni3al8qxsphl353rv19f6rblplhs"; }; - nativeBuildInputs = [ makeWrapper menhir ]; + nativeBuildInputs = [ + makeWrapper + menhir + ]; - propagatedBuildInputs = [ menhirLib merlin-extend ppx_tools_versioned ]; + buildInputs = [ + cppo + dune_2 + findlib + fix + menhir + menhirSdk + ocaml + ppxlib + utop + ]; - buildInputs = [ ocaml findlib dune_2 cppo fix utop menhir menhirSdk ]; + propagatedBuildInputs = [ + menhirLib + merlin-extend + ppx_derivers + ]; buildFlags = [ "build" ]; # do not "make tests" before reason lib is installed @@ -29,11 +46,16 @@ stdenv.mkDerivation rec { --prefix OCAMLPATH : "$OCAMLPATH:$OCAMLFIND_DESTDIR" ''; + passthru.tests = { + hello = callPackage ./tests/hello { }; + }; + meta = with lib; { homepage = "https://reasonml.github.io/"; + downloadPage = "https://github.com/reasonml/reason"; description = "Facebook's friendly syntax to OCaml"; license = licenses.mit; inherit (ocaml.meta) platforms; - maintainers = [ maintainers.volth ]; + maintainers = with maintainers; [ superherointj ]; }; } diff --git a/pkgs/development/compilers/reason/tests/hello/default.nix b/pkgs/development/compilers/reason/tests/hello/default.nix new file mode 100644 index 00000000000..9b551a0a1ee --- /dev/null +++ b/pkgs/development/compilers/reason/tests/hello/default.nix @@ -0,0 +1,23 @@ +{ lib, buildDunePackage, reason }: + +buildDunePackage rec { + pname = "helloreason"; + version = "0.0.1"; + + src = ./.; + + useDune2 = true; + + buildInputs = [ + reason + ]; + + doCheck = true; + + doInstallCheck = true; + postInstallCheck = '' + $out/bin/${pname} | grep -q "Hello From Reason" > /dev/null + ''; + + meta.timeout = 60; +} diff --git a/pkgs/development/compilers/reason/tests/hello/dune b/pkgs/development/compilers/reason/tests/hello/dune new file mode 100644 index 00000000000..578a56dc6de --- /dev/null +++ b/pkgs/development/compilers/reason/tests/hello/dune @@ -0,0 +1,4 @@ +(executable + (name helloreason) + (public_name helloreason) + (libraries reason)) diff --git a/pkgs/development/compilers/reason/tests/hello/helloreason.opam b/pkgs/development/compilers/reason/tests/hello/helloreason.opam new file mode 100644 index 00000000000..e69de29bb2d diff --git a/pkgs/development/compilers/reason/tests/hello/helloreason.re b/pkgs/development/compilers/reason/tests/hello/helloreason.re new file mode 100644 index 00000000000..795bd314dcf --- /dev/null +++ b/pkgs/development/compilers/reason/tests/hello/helloreason.re @@ -0,0 +1,6 @@ +let sayHello = () => { + let fromWhom = "From Reason"; + print_endline("Hello " ++ fromWhom); +}; + +sayHello();