2022-09-30 11:47:45 +00:00
|
|
|
{ lib
|
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitHub
|
2023-02-02 18:25:31 +00:00
|
|
|
, installShellFiles
|
2022-09-30 11:47:45 +00:00
|
|
|
, stdenv
|
2022-12-28 21:21:41 +00:00
|
|
|
, darwin
|
2023-11-16 04:20:00 +00:00
|
|
|
, rust-jemalloc-sys
|
2023-05-24 13:37:59 +00:00
|
|
|
, ruff-lsp
|
2022-09-30 11:47:45 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "ruff";
|
2024-02-29 20:09:43 +00:00
|
|
|
version = "0.2.2";
|
2022-09-30 11:47:45 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2023-07-15 17:15:38 +00:00
|
|
|
owner = "astral-sh";
|
2023-11-16 04:20:00 +00:00
|
|
|
repo = "ruff";
|
|
|
|
rev = "refs/tags/v${version}";
|
2024-02-29 20:09:43 +00:00
|
|
|
hash = "sha256-wCjPlKlw0IAh5oH4W7DUw3KBxR4bt9Ho7ncRL5TbD/0=";
|
2022-09-30 11:47:45 +00:00
|
|
|
};
|
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
cargoHash = "sha256-EHAlsEh3YnAhjIGC9rSgyK3gbKPCJqI6F3uAqZxv2nU=";
|
2023-02-02 18:25:31 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
installShellFiles
|
|
|
|
];
|
2022-09-30 11:47:45 +00:00
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
buildInputs = [
|
|
|
|
rust-jemalloc-sys
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
2022-12-28 21:21:41 +00:00
|
|
|
darwin.apple_sdk.frameworks.CoreServices
|
2022-09-30 11:47:45 +00:00
|
|
|
];
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
# tests expect no colors
|
|
|
|
preCheck = ''
|
|
|
|
export NO_COLOR=1
|
|
|
|
'';
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
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-24 13:37:59 +00:00
|
|
|
passthru.tests = {
|
|
|
|
inherit ruff-lsp;
|
|
|
|
};
|
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "An extremely fast Python linter";
|
2023-07-15 17:15:38 +00:00
|
|
|
homepage = "https://github.com/astral-sh/ruff";
|
|
|
|
changelog = "https://github.com/astral-sh/ruff/releases/tag/v${version}";
|
2022-09-30 11:47:45 +00:00
|
|
|
license = licenses.mit;
|
2023-08-10 07:59:29 +00:00
|
|
|
mainProgram = "ruff";
|
2022-09-30 11:47:45 +00:00
|
|
|
maintainers = with maintainers; [ figsoda ];
|
|
|
|
};
|
|
|
|
}
|