From a7632eb765d899d1fded33cfb51401d3fe646a90 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Mon, 5 Jan 2026 14:19:32 +0000 Subject: [PATCH] flow: cleanup --- pkgs/by-name/fl/flow/package.nix | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/pkgs/by-name/fl/flow/package.nix b/pkgs/by-name/fl/flow/package.nix index 6699329a4acb..363a511d27a0 100644 --- a/pkgs/by-name/fl/flow/package.nix +++ b/pkgs/by-name/fl/flow/package.nix @@ -4,6 +4,7 @@ fetchFromGitHub, ocaml-ng, dune, + versionCheckHook, }: let @@ -13,24 +14,19 @@ let } ); in -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "flow"; version = "0.288.0"; src = fetchFromGitHub { owner = "facebook"; repo = "flow"; - tag = "v${version}"; + tag = "v${finalAttrs.version}"; hash = "sha256-9KApZvjOSwR9wcO7nRmpPf2M5SzmV0Z0bM7O8StqZK0="; }; makeFlags = [ "FLOW_RELEASE=1" ]; - installPhase = '' - install -Dm755 bin/flow $out/bin/flow - install -Dm644 resources/shell/bash-completion $out/share/bash-completion/completions/flow - ''; - strictDeps = true; nativeBuildInputs = with ocamlPackages; [ @@ -59,13 +55,28 @@ stdenv.mkDerivation rec { ++ lib.optionals stdenv.hostPlatform.isLinux [ inotify ] ); + installPhase = '' + runHook preInstall + + install -Dm755 bin/flow $out/bin/flow + install -Dm644 resources/shell/bash-completion $out/share/bash-completion/completions/flow + + runHook postInstall + ''; + + nativeInstallCheckInputs = [ + versionCheckHook + ]; + versionCheckProgramArg = "--version"; + doInstallCheck = true; + meta = { description = "Static type checker for JavaScript"; mainProgram = "flow"; homepage = "https://flow.org/"; - changelog = "https://github.com/facebook/flow/blob/v${version}/Changelog.md"; + changelog = "https://github.com/facebook/flow/blob/${finalAttrs.src.tag}/Changelog.md"; license = lib.licenses.mit; platforms = ocamlPackages.ocaml.meta.platforms; maintainers = with lib.maintainers; [ puffnfresh ]; }; -} +})