2022-09-25 16:46:28 +00:00
|
|
|
{ lib
|
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitHub
|
2023-01-28 16:54:32 +00:00
|
|
|
, installShellFiles
|
2022-09-25 16:46:28 +00:00
|
|
|
, stdenv
|
2022-12-17 04:58:37 +00:00
|
|
|
, darwin
|
2023-07-13 19:13:10 +00:00
|
|
|
, rust-jemalloc-sys
|
2023-05-15 11:16:12 +00:00
|
|
|
# tests
|
|
|
|
, ruff-lsp
|
2022-09-25 16:46:28 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "ruff";
|
2024-01-12 06:42:46 +00:00
|
|
|
version = "0.1.13";
|
2022-09-25 16:46:28 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2023-06-09 14:59:23 +00:00
|
|
|
owner = "astral-sh";
|
2023-10-25 06:35:56 +00:00
|
|
|
repo = "ruff";
|
|
|
|
rev = "refs/tags/v${version}";
|
2024-01-12 06:42:46 +00:00
|
|
|
hash = "sha256-cH/Vw04QQ3U7E1ZCwozjhPcn0KVljP976/p3okrBpEU=";
|
2022-09-25 16:46:28 +00:00
|
|
|
};
|
|
|
|
|
2024-01-12 06:42:46 +00:00
|
|
|
cargoHash = "sha256-tmoFnghHQEsyv0vO9fnWyTsxiIhmovhi/zHXOCi5u10=";
|
2023-01-28 16:54:32 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
installShellFiles
|
|
|
|
];
|
2022-09-25 16:46:28 +00:00
|
|
|
|
2023-07-13 19:13:10 +00:00
|
|
|
buildInputs = [
|
|
|
|
rust-jemalloc-sys
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
2022-12-17 04:58:37 +00:00
|
|
|
darwin.apple_sdk.frameworks.CoreServices
|
2022-09-25 16:46:28 +00:00
|
|
|
];
|
|
|
|
|
2023-02-20 04:50:04 +00:00
|
|
|
cargoBuildFlags = [ "--package=ruff_cli" ];
|
2023-03-29 21:14:13 +00:00
|
|
|
cargoTestFlags = cargoBuildFlags;
|
2022-12-27 19:35:46 +00:00
|
|
|
|
2023-07-21 22:10:49 +00:00
|
|
|
# tests expect no colors
|
|
|
|
preCheck = ''
|
|
|
|
export NO_COLOR=1
|
|
|
|
'';
|
|
|
|
|
2023-01-28 16:54:32 +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-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";
|
2023-06-09 14:59:23 +00:00
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|