1{ lib, stdenv, fetchFromGitHub, ocamlPackages, CoreServices }:
2
3stdenv.mkDerivation rec {
4 pname = "flow";
5 version = "0.207.0";
6
7 src = fetchFromGitHub {
8 owner = "facebook";
9 repo = "flow";
10 rev = "v${version}";
11 sha256 = "sha256-0qEo1drdtIxdZriaLNm+T1J00wJoeBbtox5LDmrLX4Y=";
12 };
13
14 postPatch = ''
15 substituteInPlace src/services/inference/check_cache.ml --replace 'Core_kernel' 'Core'
16 '';
17
18 makeFlags = [ "FLOW_RELEASE=1" ];
19
20 installPhase = ''
21 install -Dm755 bin/flow $out/bin/flow
22 install -Dm644 resources/shell/bash-completion $out/share/bash-completion/completions/flow
23 '';
24
25 strictDeps = true;
26
27 nativeBuildInputs = with ocamlPackages; [ ocaml dune_3 findlib ocamlbuild ];
28
29 buildInputs = lib.optionals stdenv.isDarwin [ CoreServices ]
30 ++ (with ocamlPackages; [ core_kernel dtoa fileutils lwt_log lwt_ppx ocaml_lwt ppx_deriving ppx_gen_rec ppx_let sedlex visitors wtf8 ] ++ lib.optionals stdenv.isLinux [ inotify ]);
31
32 meta = with lib; {
33 description = "A static type checker for JavaScript";
34 homepage = "https://flow.org/";
35 changelog = "https://github.com/facebook/flow/raw/v${version}/Changelog.md";
36 license = licenses.mit;
37 platforms = ocamlPackages.ocaml.meta.platforms;
38 maintainers = with maintainers; [ marsam puffnfresh ];
39 };
40}