depot/third_party/nixpkgs/pkgs/tools/misc/zoxide/default.nix
Default email 159e378cbb Project import generated by Copybara.
GitOrigin-RevId: c04d5652cfa9742b1d519688f65d1bbccea9eb7e
2024-09-19 17:19:46 +03:00

49 lines
1.2 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, rustPlatform
, withFzf ? true
, fzf
, installShellFiles
, libiconv
}:
rustPlatform.buildRustPackage rec {
pname = "zoxide";
version = "0.9.5";
src = fetchFromGitHub {
owner = "ajeetdsouza";
repo = "zoxide";
rev = "refs/tags/v${version}";
hash = "sha256-4Vb0C6k36VQwiruGj7lu6MjDEeTh84JSHw47YMbFb30=";
};
nativeBuildInputs = [ installShellFiles ];
buildInputs = lib.optionals stdenv.isDarwin [ libiconv ];
postPatch = lib.optionalString withFzf ''
substituteInPlace src/util.rs \
--replace '"fzf"' '"${fzf}/bin/fzf"'
'';
cargoHash = "sha256-G6Aqn+q48s8Qsoa1EMowtw5bnUnnYWhyGr4hNhVYNMo=";
postInstall = ''
installManPage man/man*/*
installShellCompletion --cmd zoxide \
--bash contrib/completions/zoxide.bash \
--fish contrib/completions/zoxide.fish \
--zsh contrib/completions/_zoxide
'';
meta = with lib; {
description = "Fast cd command that learns your habits";
homepage = "https://github.com/ajeetdsouza/zoxide";
changelog = "https://github.com/ajeetdsouza/zoxide/blob/v${version}/CHANGELOG.md";
license = with licenses; [ mit ];
maintainers = with maintainers; [ ysndr cole-h SuperSandro2000 ];
mainProgram = "zoxide";
};
}