nixpkgs/pkgs/by-name/de/delta/package.nix
Alyssa Ross 63bff8c132
treewide: migrate to fetchCargoVendor, batch 1
Cargo 1.84.0 seems to have changed the output format of cargo vendor
again, once again invalidating fetchCargoTarball FOD hashes.  It's
time to fix this once and for all, switching across the board to
fetchCargoVendor, which is not dependent on cargo vendor's output
format.

It should be possible to reproduce this diff.  To do so, get the list
of files changed by this commit, e.g. with git diff --name-only, then
run the following two commands, each with that list of files as their
standard input:

	xargs sed -i 's/^\(. *\)\(cargoHash\)\b/\1useFetchCargoVendor = true;\n\1cargoHash/'
	cut -d / -f 4 | xargs -n 1 nix-update --version=skip

This will take a long time.  It might be possible to parallelize it
using xargs' -P option.  I haven't tested it.
2025-01-23 11:46:43 +01:00

75 lines
1.6 KiB
Nix

{
lib,
rustPlatform,
fetchFromGitHub,
installShellFiles,
pkg-config,
oniguruma,
stdenv,
git,
zlib,
}:
rustPlatform.buildRustPackage rec {
pname = "delta";
version = "0.18.2";
src = fetchFromGitHub {
owner = "dandavison";
repo = "delta";
tag = version;
hash = "sha256-fJSKGa935kwLG8WYmT9Ncg2ozpSNMzUJx0WLo1gtVAA=";
};
useFetchCargoVendor = true;
cargoHash = "sha256-qF55A1CENoHu3LBtNRc/n2PKYxMls7pdn2d56Mp18Qs=";
nativeBuildInputs = [
installShellFiles
pkg-config
];
buildInputs =
[
oniguruma
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
zlib
];
nativeCheckInputs = [ git ];
env = {
RUSTONIG_SYSTEM_LIBONIG = true;
};
postInstall = ''
installShellCompletion --cmd delta \
etc/completion/completion.{bash,fish,zsh}
'';
# test_env_parsing_with_pager_set_to_bat sets environment variables,
# which can be flaky with multiple threads:
# https://github.com/dandavison/delta/issues/1660
dontUseCargoParallelTests = true;
checkFlags = lib.optionals stdenv.hostPlatform.isDarwin [
# This test tries to read /etc/passwd, which fails with the sandbox
# enabled on Darwin
"--skip=test_diff_real_files"
];
meta = with lib; {
homepage = "https://github.com/dandavison/delta";
description = "Syntax-highlighting pager for git";
changelog = "https://github.com/dandavison/delta/releases/tag/${version}";
license = licenses.mit;
maintainers = with maintainers; [
zowoq
SuperSandro2000
figsoda
];
mainProgram = "delta";
};
}