diff --git a/pkgs/development/compilers/reason/default.nix b/pkgs/development/compilers/reason/default.nix new file mode 100644 index 000000000000..7bd4750551f3 --- /dev/null +++ b/pkgs/development/compilers/reason/default.nix @@ -0,0 +1,57 @@ +{ stdenv, makeWrapper, buildOcaml, fetchFromGitHub, + ocaml, opam, topkg, menhir, merlin_extend, ppx_tools_versioned, utop }: + +let + version = "1.13.4"; + src = fetchFromGitHub { + owner = "facebook"; + repo = "reason"; + rev = version; + sha256 = "03r2ciikgwaq1dkzgzc8n7h7y0q95ajh6n9bb2n5bpgfhwkr1wqi"; + }; + meta = with stdenv.lib; { + homepage = https://facebook.github.io/reason/; + description = "Facebook's friendly syntax to OCaml"; + license = licenses.bsd3; + maintainers = [ maintainers.volth ]; + }; + + reason-parser = buildOcaml { + name = "reason-parser"; + inherit version src meta; + sourceRoot = "reason-${version}-src/reason-parser"; + + minimumSupportedOcamlVersion = "4.02"; + + propagatedBuildInputs = [ menhir merlin_extend ppx_tools_versioned ]; + buildInputs = [ opam topkg ]; + + createFindlibDestdir = true; + + inherit (topkg) installPhase; + }; +in +buildOcaml { + name = "reason"; + inherit version src meta; + + buildInputs = [ makeWrapper opam topkg reason-parser utop ]; + + buildFlags = [ "build" ]; # do not "make tests" before reason lib is installed + + createFindlibDestdir = true; + + postPatch = '' + substituteInPlace src/reasonbuild.ml --replace "refmt --print binary" "$out/bin/refmt --print binary" + ''; + + installPhase = '' + ${topkg.installPhase} + + wrapProgram $out/bin/reup \ + --prefix PATH : "${opam}/bin" + wrapProgram $out/bin/rtop \ + --prefix PATH : "${utop}/bin" \ + --set OCAMLPATH $out/lib/ocaml/${ocaml.version}/site-lib:$OCAMLPATH + ''; +} diff --git a/pkgs/development/ocaml-modules/merlin_extend/default.nix b/pkgs/development/ocaml-modules/merlin_extend/default.nix new file mode 100644 index 000000000000..79b8b69bbb57 --- /dev/null +++ b/pkgs/development/ocaml-modules/merlin_extend/default.nix @@ -0,0 +1,26 @@ +{ stdenv, buildOcaml, fetchFromGitHub, cppo }: + +buildOcaml rec { + name = "merlin_extend"; + version = "0.3"; + + minimumSupportedOcamlVersion = "4.02"; + + src = fetchFromGitHub { + owner = "let-def"; + repo = "merlin-extend"; + sha256 = "1z6hybcb7ry0bkzjd0r2dlcgjnhhxdsr06x3h03sj7h5fihsc7vd"; + rev = "v${version}"; + }; + + buildInputs = [ cppo ]; + + createFindlibDestdir = true; + + meta = with stdenv.lib; { + homepage = https://github.com/let-def/merlin-extend; + description = "SDK to extend Merlin"; + license = licenses.mit; + maintainers = [ maintainers.volth ]; + }; +} diff --git a/pkgs/development/ocaml-modules/ocaml-migrate-parsetree/default.nix b/pkgs/development/ocaml-modules/ocaml-migrate-parsetree/default.nix index 3694dd2d6abc..a056cdeb1b5e 100644 --- a/pkgs/development/ocaml-modules/ocaml-migrate-parsetree/default.nix +++ b/pkgs/development/ocaml-modules/ocaml-migrate-parsetree/default.nix @@ -2,13 +2,13 @@ stdenv.mkDerivation rec { name = "ocaml${ocaml.version}-ocaml-migrate-parsetree-${version}"; - version = "0.5"; + version = "0.7"; src = fetchFromGitHub { owner = "let-def"; repo = "ocaml-migrate-parsetree"; rev = "v${version}"; - sha256 = "023lnd3kxa3d4zgsvv0z2lyzhg05zcgagy18vaalimbza57wq83h"; + sha256 = "142svvixhz153argd3khk7sr38dhiy4w6sck4766f8b48p41pp3m"; }; buildInputs = [ ocaml findlib ocamlbuild jbuilder ]; diff --git a/pkgs/development/ocaml-modules/ppx_tools_versioned/default.nix b/pkgs/development/ocaml-modules/ppx_tools_versioned/default.nix new file mode 100644 index 000000000000..c402c6be4f1b --- /dev/null +++ b/pkgs/development/ocaml-modules/ppx_tools_versioned/default.nix @@ -0,0 +1,26 @@ +{ stdenv, buildOcaml, fetchFromGitHub, ocaml-migrate-parsetree }: + +buildOcaml rec { + name = "ppx_tools_versioned"; + version = "5.0alpha"; + + minimumSupportedOcamlVersion = "4.02"; + + src = fetchFromGitHub { + owner = "let-def"; + repo = "ppx_tools_versioned"; + rev = version; + sha256 = "0sa3w0plpa0s202s9yjgz7dbk32xd2s6fymkjijrhj4lkvh08mba"; + }; + + propagatedBuildInputs = [ ocaml-migrate-parsetree ]; + + createFindlibDestdir = true; + + meta = with stdenv.lib; { + homepage = https://github.com/let-def/ppx_tools_versioned; + description = "Tools for authors of syntactic tools (such as ppx rewriters)"; + license = licenses.gpl2; + maintainers = [ maintainers.volth ]; + }; +} diff --git a/pkgs/development/tools/ocaml/utop/default.nix b/pkgs/development/tools/ocaml/utop/default.nix index 31549729cfe7..448386866493 100644 --- a/pkgs/development/tools/ocaml/utop/default.nix +++ b/pkgs/development/tools/ocaml/utop/default.nix @@ -1,5 +1,5 @@ -{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, camlp4, ocaml_react -, lambdaTerm, ocaml_lwt, makeWrapper, camomile, zed, cppo, ppx_tools +{ stdenv, fetchurl, bash, ocaml, findlib, ocamlbuild, camlp4, ocaml_react +, lambdaTerm, ocaml_lwt, camomile, zed, cppo, ppx_tools }: stdenv.mkDerivation rec { @@ -11,7 +11,7 @@ stdenv.mkDerivation rec { sha256 = "16z02vp9n97iax4fqpbi7v86r75vbabxvnd1rirh8w2miixs1g4x"; }; - buildInputs = [ ocaml findlib ocamlbuild makeWrapper cppo camlp4 ppx_tools ]; + buildInputs = [ ocaml findlib ocamlbuild cppo camlp4 ppx_tools ]; propagatedBuildInputs = [ lambdaTerm ocaml_lwt ]; @@ -35,9 +35,9 @@ stdenv.mkDerivation rec { do mv $prog .$prog-wrapped cat > $prog <