nixpkgs/pkgs/tools/misc/zoxide/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

49 lines
1.2 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, fetchFromGitHub
, rustPlatform
, withFzf ? true
, fzf
2021-05-02 01:33:00 +00:00
, installShellFiles
, libiconv
}:
rustPlatform.buildRustPackage rec {
2020-03-10 21:48:38 +00:00
pname = "zoxide";
2022-04-25 00:08:47 +00:00
version = "0.8.1";
2020-03-10 21:48:38 +00:00
src = fetchFromGitHub {
owner = "ajeetdsouza";
repo = "zoxide";
rev = "v${version}";
2022-04-25 00:08:47 +00:00
sha256 = "sha256-f6HzSnrOaAOnA9k6e3CnXioxCTOM0VSpTOpxnmz+Tyk=";
2020-03-10 21:48:38 +00:00
};
2021-05-02 01:33:00 +00:00
nativeBuildInputs = [ installShellFiles ];
buildInputs = lib.optionals stdenv.isDarwin [ libiconv ];
postPatch = lib.optionalString withFzf ''
2022-04-25 00:08:47 +00:00
substituteInPlace src/util.rs \
2020-05-25 09:20:00 +00:00
--replace '"fzf"' '"${fzf}/bin/fzf"'
'';
2020-03-10 21:48:38 +00:00
2022-04-25 00:08:47 +00:00
cargoSha256 = "sha256-OAvE/KFoS4+18J+kOZTYa9zgnkWh/0bgy9iglGyZ8PQ=";
2020-03-10 21:48:38 +00:00
2021-05-02 01:33:00 +00:00
postInstall = ''
2022-04-25 00:08:47 +00:00
installManPage man/man*/*
2021-06-14 15:43:15 +00:00
installShellCompletion --cmd zoxide \
--bash contrib/completions/zoxide.bash \
--fish contrib/completions/zoxide.fish \
--zsh contrib/completions/_zoxide
2021-05-02 01:33:00 +00:00
'';
meta = with lib; {
2020-03-10 21:48:38 +00:00
description = "A fast cd command that learns your habits";
homepage = "https://github.com/ajeetdsouza/zoxide";
2021-05-02 01:33:00 +00:00
changelog = "https://github.com/ajeetdsouza/zoxide/raw/v${version}/CHANGELOG.md";
2020-03-10 21:48:38 +00:00
license = with licenses; [ mit ];
maintainers = with maintainers; [ ysndr cole-h SuperSandro2000 ];
2020-03-10 21:48:38 +00:00
};
}