about summary refs log tree commit diff
path: root/pkgs/development/tools
diff options
context:
space:
mode:
authorteh <tehunger@gmail.com>2018-07-11 00:20:17 +0100
committerxeji <36407913+xeji@users.noreply.github.com>2018-07-11 01:20:17 +0200
commit17fe19f5bf691af54249cca804055ca217a6f8c3 (patch)
tree5f17fbf37e0e483b3a7b0d1465cde3f9023cedd4 /pkgs/development/tools
parent60629ce2c5edc0b1d05af63f4a77f9779ac6afc4 (diff)
downloadnixlib-17fe19f5bf691af54249cca804055ca217a6f8c3.tar
nixlib-17fe19f5bf691af54249cca804055ca217a6f8c3.tar.gz
nixlib-17fe19f5bf691af54249cca804055ca217a6f8c3.tar.bz2
nixlib-17fe19f5bf691af54249cca804055ca217a6f8c3.tar.lz
nixlib-17fe19f5bf691af54249cca804055ca217a6f8c3.tar.xz
nixlib-17fe19f5bf691af54249cca804055ca217a6f8c3.tar.zst
nixlib-17fe19f5bf691af54249cca804055ca217a6f8c3.zip
pyre: init at 0.0.8 (#43212)
Diffstat (limited to 'pkgs/development/tools')
-rw-r--r--pkgs/development/tools/pyre/default.nix71
1 files changed, 71 insertions, 0 deletions
diff --git a/pkgs/development/tools/pyre/default.nix b/pkgs/development/tools/pyre/default.nix
new file mode 100644
index 000000000000..7cbfc4385048
--- /dev/null
+++ b/pkgs/development/tools/pyre/default.nix
@@ -0,0 +1,71 @@
+{ stdenv, fetchFromGitHub, ocamlPackages, makeWrapper, writeScript }:
+let
+  # Manually set version - the setup script requires
+  # hg and git + keeping the .git directory around.
+  version = "0.0.8";
+  versionFile = writeScript "version.ml" ''
+    cat > "./version.ml" <<EOF
+    let build_info () =
+    "pyre-nixpkgs ${version}"
+    let version () =
+    "${version}"
+    EOF
+  '';
+in stdenv.mkDerivation {
+  name = "pyre-${version}";
+
+  src = fetchFromGitHub {
+    owner = "facebook";
+    repo = "pyre-check";
+    rev = "v${version}";
+    sha256 = "0c4km27xnzsqcqvjqxmqak37x473z6azlbldy7f05ghkms7mchrw";
+  };
+
+  nativeBuildInputs = [ makeWrapper ];
+
+  buildInputs = with ocamlPackages; [
+    ocaml
+    findlib
+    menhir
+    yojson
+    core
+    sedlex
+    ppx_deriving_yojson
+    ocamlbuild
+    ppxlib
+  ];
+
+  buildPhase = ''
+    # build requires HOME to be set
+    export HOME=.
+
+    # "external" because https://github.com/facebook/pyre-check/pull/8/files
+    sed "s/%VERSION%/external ${version}/" Makefile.template > Makefile
+
+    cp ${versionFile} ./scripts/generate-version-number.sh
+
+    mkdir $(pwd)/build
+    export OCAMLFIND_DESTDIR=$(pwd)/build
+    export OCAMLPATH=$OCAMLPATH:$(pwd)/build
+    make release
+  '';
+
+  checkPhase = ''
+    make test
+  '';
+
+  # Note that we're not installing the typeshed yet.
+  # Improvement for a future version.
+  installPhase = ''
+    mkdir -p $out/bin
+    cp _build/all/main.native $out/bin/pyre
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A performant type-checker for Python 3";
+    homepage = https://pyre-check.org;
+    license = licenses.mit;
+    platforms = with platforms; linux;
+    maintainers = with maintainers; [ teh ];
+  };
+}