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

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

63 lines
1.4 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
# tests
, ruff-lsp
2022-09-25 16:46:28 +00:00
}:
rustPlatform.buildRustPackage rec {
pname = "ruff";
version = "0.1.13";
2022-09-25 16:46:28 +00:00
src = fetchFromGitHub {
owner = "astral-sh";
repo = "ruff";
rev = "refs/tags/v${version}";
hash = "sha256-cH/Vw04QQ3U7E1ZCwozjhPcn0KVljP976/p3okrBpEU=";
2022-09-25 16:46:28 +00:00
};
cargoHash = "sha256-tmoFnghHQEsyv0vO9fnWyTsxiIhmovhi/zHXOCi5u10=";
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
];
cargoBuildFlags = [ "--package=ruff_cli" ];
cargoTestFlags = cargoBuildFlags;
# 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 ];
};
}