mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-10-20 11:11:43 -04:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
67 lines
1.5 KiB
Nix
67 lines
1.5 KiB
Nix
{ lib
|
|
, rustPlatform
|
|
, fetchFromGitHub
|
|
, installShellFiles
|
|
, pkg-config
|
|
, oniguruma
|
|
, stdenv
|
|
, darwin
|
|
, git
|
|
}:
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "delta";
|
|
version = "0.18.2";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "dandavison";
|
|
repo = "delta";
|
|
rev = "refs/tags/${version}";
|
|
hash = "sha256-fJSKGa935kwLG8WYmT9Ncg2ozpSNMzUJx0WLo1gtVAA=";
|
|
};
|
|
|
|
cargoHash = "sha256-DIWzRVTADfAZdFckhh2lIfOD13h7GP3KIOQHf/oBHgc=";
|
|
|
|
nativeBuildInputs = [
|
|
installShellFiles
|
|
pkg-config
|
|
];
|
|
|
|
buildInputs = [
|
|
oniguruma
|
|
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
|
|
darwin.apple_sdk_11_0.frameworks.Foundation
|
|
];
|
|
|
|
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";
|
|
};
|
|
}
|