about summary refs log tree commit diff
path: root/pkgs/development/compilers/reason/default.nix
diff options
context:
space:
mode:
authorVolth <volth@webmaster.ms>2017-04-08 11:34:41 +0000
committerVolth <volth@webmaster.ms>2017-04-23 11:23:21 +0000
commitaa8d50ce0b815668bc5bf5fb1a6a0b31722ea395 (patch)
tree43fd97f0684e8d09f62e97c766958c2fdcac235e /pkgs/development/compilers/reason/default.nix
parentf1bc5a3a83bc8f101f0f40b2921e071a28160212 (diff)
downloadnixlib-aa8d50ce0b815668bc5bf5fb1a6a0b31722ea395.tar
nixlib-aa8d50ce0b815668bc5bf5fb1a6a0b31722ea395.tar.gz
nixlib-aa8d50ce0b815668bc5bf5fb1a6a0b31722ea395.tar.bz2
nixlib-aa8d50ce0b815668bc5bf5fb1a6a0b31722ea395.tar.lz
nixlib-aa8d50ce0b815668bc5bf5fb1a6a0b31722ea395.tar.xz
nixlib-aa8d50ce0b815668bc5bf5fb1a6a0b31722ea395.tar.zst
nixlib-aa8d50ce0b815668bc5bf5fb1a6a0b31722ea395.zip
reason: init at 1.13.3
Diffstat (limited to 'pkgs/development/compilers/reason/default.nix')
-rw-r--r--pkgs/development/compilers/reason/default.nix57
1 files changed, 57 insertions, 0 deletions
diff --git a/pkgs/development/compilers/reason/default.nix b/pkgs/development/compilers/reason/default.nix
new file mode 100644
index 000000000000..bcf3defd51a2
--- /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.3";
+  src = fetchFromGitHub {
+    owner = "facebook";
+    repo = "reason";
+    rev = version;
+    sha256 = "1b0dsnw69kkvix4iqlbcbfyr9j6zx2y2cbrp13f7y387hv6i7zkx";
+  };
+  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
+  '';
+}