nixpkgs/pkgs/development/tools/ruff/default.nix

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

59 lines
1.3 KiB
Nix
Raw Normal View History

2022-09-25 16:46:28 +00:00
{ lib
, rustPlatform
, fetchFromGitHub
, installShellFiles
2022-09-25 16:46:28 +00:00
, stdenv
, darwin
, rust-jemalloc-sys
2023-05-15 11:16:12 +00:00
, ruff-lsp
2022-09-25 16:46:28 +00:00
}:
rustPlatform.buildRustPackage rec {
pname = "ruff";
version = "0.2.2";
2022-09-25 16:46:28 +00:00
src = fetchFromGitHub {
owner = "astral-sh";
repo = "ruff";
rev = "refs/tags/v${version}";
hash = "sha256-wCjPlKlw0IAh5oH4W7DUw3KBxR4bt9Ho7ncRL5TbD/0=";
2022-09-25 16:46:28 +00:00
};
cargoHash = "sha256-EHAlsEh3YnAhjIGC9rSgyK3gbKPCJqI6F3uAqZxv2nU=";
nativeBuildInputs = [
installShellFiles
];
2022-09-25 16:46:28 +00:00
buildInputs = [
rust-jemalloc-sys
] ++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.CoreServices
2022-09-25 16:46:28 +00:00
];
# 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)
'';
2023-05-15 11:16:12 +00:00
passthru.tests = {
inherit ruff-lsp;
};
2022-09-25 16:46:28 +00:00
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}";
2022-09-25 16:46:28 +00:00
license = licenses.mit;
2023-08-05 01:57:14 +00:00
mainProgram = "ruff";
2022-09-25 16:46:28 +00:00
maintainers = with maintainers; [ figsoda ];
};
}