nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 ocaml-ng,
6 dune,
7 versionCheckHook,
8}:
9
10let
11 ocamlPackages = ocaml-ng.ocamlPackages_5_3.overrideScope (
12 self: super: {
13 ppxlib = super.ppxlib.override { version = "0.34.0"; };
14 }
15 );
16in
17stdenv.mkDerivation (finalAttrs: {
18 pname = "flow";
19 version = "0.299.0";
20
21 src = fetchFromGitHub {
22 owner = "facebook";
23 repo = "flow";
24 tag = "v${finalAttrs.version}";
25 hash = "sha256-ohGqzTI0TW92lsM9fqJv8iRk3SZkKT03Ek+15Lj2RYU=";
26 };
27
28 patches = [
29 # error: 'uint64_t' does not name a type
30 ./gcc-15-compat.patch
31 ];
32
33 makeFlags = [ "FLOW_RELEASE=1" ];
34
35 strictDeps = true;
36
37 nativeBuildInputs = with ocamlPackages; [
38 ocaml
39 dune
40 findlib
41 ocamlbuild
42 ];
43
44 buildInputs = (
45 with ocamlPackages;
46 [
47 camlp-streams
48 dtoa
49 fileutils
50 lwt_log
51 lwt_ppx
52 lwt
53 ppx_deriving
54 ppx_gen_rec
55 ppx_let
56 sedlex
57 visitors
58 wtf8
59 ]
60 ++ lib.optionals stdenv.hostPlatform.isLinux [ inotify ]
61 );
62
63 installPhase = ''
64 runHook preInstall
65
66 install -Dm755 bin/flow $out/bin/flow
67 install -Dm644 resources/shell/bash-completion $out/share/bash-completion/completions/flow
68
69 runHook postInstall
70 '';
71
72 nativeInstallCheckInputs = [
73 versionCheckHook
74 ];
75 versionCheckProgramArg = "--version";
76 doInstallCheck = true;
77
78 meta = {
79 description = "Static type checker for JavaScript";
80 mainProgram = "flow";
81 homepage = "https://flow.org/";
82 changelog = "https://github.com/facebook/flow/blob/${finalAttrs.src.tag}/Changelog.md";
83 license = lib.licenses.mit;
84 platforms = ocamlPackages.ocaml.meta.platforms;
85 maintainers = with lib.maintainers; [ puffnfresh ];
86 };
87})