16 , withClipboard ? !stdenv.hostPlatform.isDarwin
17 , withTrash ? !stdenv.hostPlatform.isDarwin
20 rustPlatform.buildRustPackage rec {
24 src = fetchFromGitHub {
28 hash = "sha256-Qyc4R5hvSal82/qywriH7agluu6miAC4Y7UUM3VATCo=";
31 cargoHash = "sha256-fsmwjr7EpzR/KKrGWoTeCOI7jmrlTYtjIksc205kRs8=";
39 buildInputs = [ libgit2 oniguruma xorg.libxcb ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
46 buildFeatures = lib.optionals withTrash [ "trash" ] ++ lib.optionals withClipboard [ "clipboard" ];
48 RUSTONIG_SYSTEM_LIBONIG = true;
51 # Fill the version stub in the man page. We can't fill the date
53 substitute man/page man/broot.1 \
54 --replace "#version" "${version}"
57 postInstall = lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) ''
58 # Install shell function for bash.
59 ${stdenv.hostPlatform.emulator buildPackages} $out/bin/broot --print-shell-function bash > br.bash
60 install -Dm0444 -t $out/etc/profile.d br.bash
62 # Install shell function for zsh.
63 ${stdenv.hostPlatform.emulator buildPackages} $out/bin/broot --print-shell-function zsh > br.zsh
64 install -Dm0444 br.zsh $out/share/zsh/site-functions/br
66 # Install shell function for fish
67 ${stdenv.hostPlatform.emulator buildPackages} $out/bin/broot --print-shell-function fish > br.fish
68 install -Dm0444 -t $out/share/fish/vendor_functions.d br.fish
71 # install shell completion files
72 OUT_DIR=$releaseDir/build/broot-*/out
74 installShellCompletion --bash $OUT_DIR/{br,broot}.bash
75 installShellCompletion --fish $OUT_DIR/{br,broot}.fish
76 installShellCompletion --zsh $OUT_DIR/{_br,_broot}
78 installManPage man/broot.1
80 # Do not nag users about installing shell integration, since
82 wrapProgram $out/bin/broot \
86 doInstallCheck = true;
87 installCheckPhase = ''
88 $out/bin/broot --version | grep "${version}"
92 description = "Interactive tree view, a fuzzy search, a balanced BFS descent and customizable commands";
93 homepage = "https://dystroy.org/broot/";
94 changelog = "https://github.com/Canop/broot/releases/tag/v${version}";
95 maintainers = with maintainers; [ dywedir ];
96 license = with licenses; [ mit ];
97 mainProgram = "broot";