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-06-05 15:53:02 +00:00
|
|
|
version = "0.4.7";
|
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-06-05 15:53:02 +00:00
|
|
|
hash = "sha256-1WQQpIdGFWEq6HzFFA5qRC3wnqtUvdzC/6VIkDY1pZI=";
|
2022-09-30 11:47:45 +00:00
|
|
|
};
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
cargoLock = {
|
|
|
|
lockFile = ./Cargo.lock;
|
|
|
|
outputHashes = {
|
|
|
|
"lsp-types-0.95.1" = "sha256-8Oh299exWXVi6A39pALOISNfp8XBya8z+KT/Z7suRxQ=";
|
|
|
|
};
|
|
|
|
};
|
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;
|
|
|
|
};
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
meta = {
|
2022-09-30 11:47:45 +00:00
|
|
|
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}";
|
2024-06-05 15:53:02 +00:00
|
|
|
license = lib.licenses.mit;
|
2023-08-10 07:59:29 +00:00
|
|
|
mainProgram = "ruff";
|
2024-06-05 15:53:02 +00:00
|
|
|
maintainers = with lib.maintainers; [
|
|
|
|
figsoda
|
|
|
|
GaetanLepage
|
|
|
|
];
|
2022-09-30 11:47:45 +00:00
|
|
|
};
|
|
|
|
}
|