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
|
2024-01-02 11:29:13 +00:00
|
|
|
, Foundation
|
2020-08-20 17:08:02 +00:00
|
|
|
, Security
|
2022-10-21 18:38:19 +00:00
|
|
|
, xorg
|
2021-05-20 23:08:51 +00:00
|
|
|
, zlib
|
2023-02-22 10:55:15 +00:00
|
|
|
, buildPackages
|
2024-01-02 11:29:13 +00:00
|
|
|
, withClipboard ? false
|
2020-08-20 17:08:02 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "broot";
|
2024-01-02 11:29:13 +00:00
|
|
|
version = "1.31.0";
|
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}";
|
2024-01-02 11:29:13 +00:00
|
|
|
hash = "sha256-orZAJtQwJ2pFG7c+VcOsck3o06qzMxLZYqRMqMhCZAw=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
cargoHash = "sha256-JQxvjt0rWwZAmWPfV120Olxf4iTVqMqUFGRdLlnT2Lw=";
|
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 [
|
2024-01-02 11:29:13 +00:00
|
|
|
Foundation
|
2020-09-25 04:45:31 +00:00
|
|
|
libiconv
|
|
|
|
Security
|
|
|
|
zlib
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
buildFeatures = lib.optionals withClipboard [ "clipboard" ];
|
|
|
|
|
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
|
|
|
'';
|
|
|
|
|
2023-02-22 10:55:15 +00:00
|
|
|
postInstall = lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) ''
|
2020-08-20 17:08:02 +00:00
|
|
|
# Install shell function for bash.
|
2023-02-22 10:55:15 +00:00
|
|
|
${stdenv.hostPlatform.emulator buildPackages} $out/bin/broot --print-shell-function bash > br.bash
|
2020-08-20 17:08:02 +00:00
|
|
|
install -Dm0444 -t $out/etc/profile.d br.bash
|
|
|
|
|
|
|
|
# Install shell function for zsh.
|
2023-02-22 10:55:15 +00:00
|
|
|
${stdenv.hostPlatform.emulator buildPackages} $out/bin/broot --print-shell-function zsh > br.zsh
|
2020-08-20 17:08:02 +00:00
|
|
|
install -Dm0444 br.zsh $out/share/zsh/site-functions/br
|
|
|
|
|
|
|
|
# Install shell function for fish
|
2023-02-22 10:55:15 +00:00
|
|
|
${stdenv.hostPlatform.emulator buildPackages} $out/bin/broot --print-shell-function fish > br.fish
|
2020-08-20 17:08:02 +00:00
|
|
|
install -Dm0444 -t $out/share/fish/vendor_functions.d br.fish
|
|
|
|
|
2023-02-22 10:55:15 +00:00
|
|
|
'' + ''
|
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
|
2023-02-22 10:55:15 +00:00
|
|
|
|
|
|
|
# Do not nag users about installing shell integration, since
|
|
|
|
# it is impure.
|
|
|
|
wrapProgram $out/bin/broot \
|
|
|
|
--set BR_INSTALL no
|
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 ];
|
2024-01-02 11:29:13 +00:00
|
|
|
mainProgram = "broot";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|