nixpkgs/pkgs/tools/misc/broot/default.nix
2020-07-31 18:06:04 +00:00

48 lines
1.4 KiB
Nix

{ stdenv, rustPlatform, fetchFromGitHub, coreutils, libiconv, Security, installShellFiles }:
rustPlatform.buildRustPackage rec {
pname = "broot";
version = "0.19.3";
src = fetchFromGitHub {
owner = "Canop";
repo = pname;
rev = "v${version}";
sha256 = "0w03dqm9m2d41ldmjv529azpbp28jjmv21apwf6rlxh59wqgicgb";
};
cargoSha256 = "1rmhlqq5a7rfsk4m0yzl9smq33xhb5ixw11knz96ih23a53yafsc";
nativeBuildInputs = [ installShellFiles ];
buildInputs = stdenv.lib.optionals stdenv.isDarwin [ libiconv Security ];
postPatch = ''
substituteInPlace src/verb/builtin.rs --replace '"/bin/' '"${coreutils}/bin/'
# 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}"
'';
postInstall = ''
# install shell completion files
OUT_DIR=$releaseDir/build/broot-*/out
installShellCompletion --bash $OUT_DIR/{br,broot}.bash
installShellCompletion --fish $OUT_DIR/{br,broot}.fish
installShellCompletion --zsh $OUT_DIR/{_br,_broot}
installManPage man/broot.1
'';
meta = with stdenv.lib; {
description = "An interactive tree view, a fuzzy search, a balanced BFS descent and customizable commands";
homepage = "https://dystroy.org/broot/";
maintainers = with maintainers; [ magnetophon ];
license = with licenses; [ mit ];
platforms = platforms.all;
};
}