mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-16 18:53:17 +00:00
63 lines
1.4 KiB
Nix
63 lines
1.4 KiB
Nix
{ lib
|
|
, rustPlatform
|
|
, fetchFromGitHub
|
|
, installShellFiles
|
|
, stdenv
|
|
, darwin
|
|
, rust-jemalloc-sys
|
|
# tests
|
|
, ruff-lsp
|
|
}:
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "ruff";
|
|
version = "0.1.3";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "astral-sh";
|
|
repo = "ruff";
|
|
rev = "refs/tags/v${version}";
|
|
hash = "sha256-AHnEvDzuQd6W+n9wXhMt6TJwoH1rZEY5UXbhFGwl8+g=";
|
|
};
|
|
|
|
cargoHash = "sha256-E4alnDonG45JBAKdLI2eaI+fXW2xOo21HI2UtBEVTx0=";
|
|
|
|
nativeBuildInputs = [
|
|
installShellFiles
|
|
];
|
|
|
|
buildInputs = [
|
|
rust-jemalloc-sys
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
darwin.apple_sdk.frameworks.CoreServices
|
|
];
|
|
|
|
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)
|
|
'';
|
|
|
|
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 ];
|
|
};
|
|
}
|