1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 ocamlPackages,
6}:
7
8stdenv.mkDerivation rec {
9 pname = "flow";
10 version = "0.238.3";
11
12 src = fetchFromGitHub {
13 owner = "facebook";
14 repo = "flow";
15 rev = "v${version}";
16 hash = "sha256-WlHta/wXTULehopXeIUdNAQb12Lf0SJnm1HIVHTDshA=";
17 };
18
19 postPatch = ''
20 substituteInPlace src/services/inference/check_cache.ml --replace 'Core_kernel' 'Core'
21 '';
22
23 makeFlags = [ "FLOW_RELEASE=1" ];
24
25 installPhase = ''
26 install -Dm755 bin/flow $out/bin/flow
27 install -Dm644 resources/shell/bash-completion $out/share/bash-completion/completions/flow
28 '';
29
30 strictDeps = true;
31
32 nativeBuildInputs = with ocamlPackages; [
33 ocaml
34 dune_3
35 findlib
36 ocamlbuild
37 ];
38
39 buildInputs = (
40 with ocamlPackages;
41 [
42 core_kernel
43 dtoa
44 fileutils
45 lwt_log
46 lwt_ppx
47 ocaml_lwt
48 ppx_deriving
49 ppx_gen_rec
50 ppx_let
51 sedlex
52 visitors
53 wtf8
54 ]
55 ++ lib.optionals stdenv.hostPlatform.isLinux [ inotify ]
56 );
57
58 meta = with lib; {
59 description = "Static type checker for JavaScript";
60 mainProgram = "flow";
61 homepage = "https://flow.org/";
62 changelog = "https://github.com/facebook/flow/blob/v${version}/Changelog.md";
63 license = licenses.mit;
64 platforms = ocamlPackages.ocaml.meta.platforms;
65 maintainers = with maintainers; [ puffnfresh ];
66 };
67}