depot/third_party/nixpkgs/pkgs/development/tools/ruff/default.nix
Default email 5c370c0b2a Project import generated by Copybara.
GitOrigin-RevId: 33d1e753c82ffc557b4a585c77de43d4c922ebb5
2024-05-15 17:35:15 +02:00

58 lines
1.3 KiB
Nix

{ lib
, rustPlatform
, fetchFromGitHub
, installShellFiles
, stdenv
, darwin
, rust-jemalloc-sys
, ruff-lsp
}:
rustPlatform.buildRustPackage rec {
pname = "ruff";
version = "0.4.4";
src = fetchFromGitHub {
owner = "astral-sh";
repo = "ruff";
rev = "refs/tags/v${version}";
hash = "sha256-ViXKGcuDla428mI2Am67gtOxfia5VfR+ry2qyczXO/I=";
};
cargoHash = "sha256-VVdIWUQaquVX/8szJ30qPGtG6rFfRadeIvDONd8swro=";
nativeBuildInputs = [
installShellFiles
];
buildInputs = [
rust-jemalloc-sys
] ++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.CoreServices
];
# tests expect no colors
preCheck = ''
export NO_COLOR=1
'';
postInstall = ''
installShellCompletion --cmd ruff \
--bash <($out/bin/ruff generate-shell-completion bash) \
--fish <($out/bin/ruff generate-shell-completion fish) \
--zsh <($out/bin/ruff generate-shell-completion zsh)
'';
passthru.tests = {
inherit ruff-lsp;
};
meta = with lib; {
description = "An extremely fast Python linter";
homepage = "https://github.com/astral-sh/ruff";
changelog = "https://github.com/astral-sh/ruff/releases/tag/v${version}";
license = licenses.mit;
mainProgram = "ruff";
maintainers = with maintainers; [ figsoda ];
};
}