2021-04-25 03:57:28 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-08-20 17:08:02 +00:00
|
|
|
, rustPlatform
|
2023-01-11 07:51:40 +00:00
|
|
|
, fetchFromGitHub
|
2020-08-20 17:08:02 +00:00
|
|
|
, installShellFiles
|
|
|
|
, makeWrapper
|
2021-05-20 23:08:51 +00:00
|
|
|
, pkg-config
|
|
|
|
, libgit2
|
|
|
|
, oniguruma
|
2020-08-20 17:08:02 +00:00
|
|
|
, libiconv
|
|
|
|
, Security
|
2022-10-21 18:38:19 +00:00
|
|
|
, xorg
|
2021-05-20 23:08:51 +00:00
|
|
|
, zlib
|
2020-08-20 17:08:02 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "broot";
|
2023-02-16 17:41:37 +00:00
|
|
|
version = "1.20.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-01-11 07:51:40 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Canop";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2023-02-16 17:41:37 +00:00
|
|
|
hash = "sha256-W8B4e8x9IoINR4NSm8jVBqXZbe1T/4z3RVmNrLVzV1M=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-02-16 17:41:37 +00:00
|
|
|
cargoHash = "sha256-XEvIqzSkusOv+boNZbTRxXVN566SduNDcZSkomJRMsk=";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
installShellFiles
|
2021-05-20 23:08:51 +00:00
|
|
|
makeWrapper
|
|
|
|
pkg-config
|
2020-09-25 04:45:31 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
buildInputs = [ libgit2 oniguruma xorg.libxcb ] ++ lib.optionals stdenv.isDarwin [
|
2020-09-25 04:45:31 +00:00
|
|
|
libiconv
|
|
|
|
Security
|
|
|
|
zlib
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
RUSTONIG_SYSTEM_LIBONIG = true;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postPatch = ''
|
2020-07-18 16:06:22 +00:00
|
|
|
# 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}"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
2020-08-20 17:08:02 +00:00
|
|
|
# Do not nag users about installing shell integration, since
|
|
|
|
# it is impure.
|
|
|
|
wrapProgram $out/bin/broot \
|
|
|
|
--set BR_INSTALL no
|
|
|
|
|
|
|
|
# Install shell function for bash.
|
|
|
|
$out/bin/broot --print-shell-function bash > br.bash
|
|
|
|
install -Dm0444 -t $out/etc/profile.d br.bash
|
|
|
|
|
|
|
|
# Install shell function for zsh.
|
|
|
|
$out/bin/broot --print-shell-function zsh > br.zsh
|
|
|
|
install -Dm0444 br.zsh $out/share/zsh/site-functions/br
|
|
|
|
|
|
|
|
# Install shell function for fish
|
|
|
|
$out/bin/broot --print-shell-function fish > br.fish
|
|
|
|
install -Dm0444 -t $out/share/fish/vendor_functions.d br.fish
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
# install shell completion files
|
2020-05-03 17:38:23 +00:00
|
|
|
OUT_DIR=$releaseDir/build/broot-*/out
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
installShellCompletion --bash $OUT_DIR/{br,broot}.bash
|
|
|
|
installShellCompletion --fish $OUT_DIR/{br,broot}.fish
|
|
|
|
installShellCompletion --zsh $OUT_DIR/{_br,_broot}
|
2020-07-18 16:06:22 +00:00
|
|
|
|
|
|
|
installManPage man/broot.1
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-12-19 01:06:50 +00:00
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase = ''
|
|
|
|
$out/bin/broot --version | grep "${version}"
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "An interactive tree view, a fuzzy search, a balanced BFS descent and customizable commands";
|
|
|
|
homepage = "https://dystroy.org/broot/";
|
2021-12-19 01:06:50 +00:00
|
|
|
changelog = "https://github.com/Canop/broot/releases/tag/v${version}";
|
2021-08-05 21:33:18 +00:00
|
|
|
maintainers = with maintainers; [ dywedir ];
|
2020-04-24 23:36:52 +00:00
|
|
|
license = with licenses; [ mit ];
|
|
|
|
};
|
|
|
|
}
|