From f783f655af72fc765f666a611b4105aa9625e06d Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Sat, 3 May 2025 20:54:33 +0200 Subject: [PATCH] broot: modernise, cleanup, use `versionCheckHook` --- pkgs/by-name/br/broot/package.nix | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/pkgs/by-name/br/broot/package.nix b/pkgs/by-name/br/broot/package.nix index 4a17c10874ff..0d458da4f6b9 100644 --- a/pkgs/by-name/br/broot/package.nix +++ b/pkgs/by-name/br/broot/package.nix @@ -4,23 +4,24 @@ rustPlatform, fetchFromGitHub, installShellFiles, - makeWrapper, + makeBinaryWrapper, pkg-config, libgit2, zlib, buildPackages, + versionCheckHook, withClipboard ? true, withTrash ? !stdenv.hostPlatform.isDarwin, }: -rustPlatform.buildRustPackage rec { +rustPlatform.buildRustPackage (finalAttrs: { pname = "broot"; version = "1.46.3"; src = fetchFromGitHub { owner = "Canop"; repo = "broot"; - rev = "v${version}"; + tag = "v${finalAttrs.version}"; hash = "sha256-MfBlJ7SokBKkAkmBSj4NsE2hKVqYeGN3z/xiq2VK3vU="; }; @@ -29,7 +30,7 @@ rustPlatform.buildRustPackage rec { nativeBuildInputs = [ installShellFiles - makeWrapper + makeBinaryWrapper pkg-config ]; @@ -43,13 +44,13 @@ rustPlatform.buildRustPackage rec { buildFeatures = lib.optionals withTrash [ "trash" ] ++ lib.optionals withClipboard [ "clipboard" ]; - RUSTONIG_SYSTEM_LIBONIG = true; + env.RUSTONIG_SYSTEM_LIBONIG = true; postPatch = '' # Fill the version stub in the man page. We can't fill the date # stub reproducibly. substitute man/page man/broot.1 \ - --replace "#version" "${version}" + --replace-fail "#version" "${finalAttrs.version}" ''; postInstall = @@ -84,16 +85,15 @@ rustPlatform.buildRustPackage rec { ''; doInstallCheck = true; - installCheckPhase = '' - $out/bin/broot --version | grep "${version}" - ''; + nativeInstallCheckInputs = [ versionCheckHook ]; + versionCheckProgramArg = "--version"; meta = with lib; { description = "Interactive tree view, a fuzzy search, a balanced BFS descent and customizable commands"; homepage = "https://dystroy.org/broot/"; - changelog = "https://github.com/Canop/broot/releases/tag/v${version}"; + changelog = "https://github.com/Canop/broot/releases/tag/v${finalAttrs.version}"; maintainers = with maintainers; [ dywedir ]; license = with licenses; [ mit ]; mainProgram = "broot"; }; -} +})