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

61 lines
1.1 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, fetchFromGitHub
, rustPlatform
, withFzf ? true
, fzf
, libiconv
# checkInputs
, fish
, powershell
, shellcheck
, shfmt
, xonsh
, zsh
}:
rustPlatform.buildRustPackage rec {
2020-03-10 14:48:38 -07:00
pname = "zoxide";
version = "0.6.0";
2020-03-10 14:48:38 -07:00
src = fetchFromGitHub {
owner = "ajeetdsouza";
repo = "zoxide";
rev = "v${version}";
sha256 = "ZeGFsVBpEhKi4EIhpQlCuriFzmHAgLYw3qE/zqfyqgU=";
2020-03-10 14:48:38 -07:00
};
buildInputs = lib.optionals stdenv.isDarwin [ libiconv ];
# tests are broken on darwin
doCheck = !stdenv.isDarwin;
# fish needs a writable HOME for whatever reason
preCheck = ''
export HOME=$(mktemp -d)
'';
checkInputs = [
fish
powershell
shellcheck
shfmt
xonsh
zsh
];
postPatch = lib.optionalString withFzf ''
2020-05-25 02:20:00 -07:00
substituteInPlace src/fzf.rs \
--replace '"fzf"' '"${fzf}/bin/fzf"'
'';
2020-03-10 14:48:38 -07:00
cargoSha256 = "Hzn01+OhdBrZD1woXN4Pwf/S72Deln1gyyBOWyDC6iM=";
2020-03-10 14:48:38 -07:00
meta = with lib; {
2020-03-10 14:48:38 -07:00
description = "A fast cd command that learns your habits";
homepage = "https://github.com/ajeetdsouza/zoxide";
license = with licenses; [ mit ];
maintainers = with maintainers; [ ysndr cole-h SuperSandro2000 ];
2020-03-10 14:48:38 -07:00
};
}