c7cb07f092
GitOrigin-RevId: 1536926ef5621b09bba54035ae2bb6d806d72ac8
58 lines
1.3 KiB
Nix
58 lines
1.3 KiB
Nix
{ lib
|
|
, rustPlatform
|
|
, fetchFromGitHub
|
|
, installShellFiles
|
|
, stdenv
|
|
, darwin
|
|
, rust-jemalloc-sys
|
|
, ruff-lsp
|
|
}:
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "ruff";
|
|
version = "0.2.2";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "astral-sh";
|
|
repo = "ruff";
|
|
rev = "refs/tags/v${version}";
|
|
hash = "sha256-wCjPlKlw0IAh5oH4W7DUw3KBxR4bt9Ho7ncRL5TbD/0=";
|
|
};
|
|
|
|
cargoHash = "sha256-EHAlsEh3YnAhjIGC9rSgyK3gbKPCJqI6F3uAqZxv2nU=";
|
|
|
|
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 ];
|
|
};
|
|
}
|