depot/third_party/nixpkgs/pkgs/development/tools/ruff/default.nix
Default email eaf6957cd3 Project import generated by Copybara.
GitOrigin-RevId: 4bb072f0a8b267613c127684e099a70e1f6ff106
2023-03-27 12:17:25 -07:00

59 lines
1.7 KiB
Nix

{ lib
, rustPlatform
, fetchFromGitHub
, installShellFiles
, stdenv
, darwin
}:
rustPlatform.buildRustPackage rec {
pname = "ruff";
version = "0.0.259";
src = fetchFromGitHub {
owner = "charliermarsh";
repo = pname;
rev = "v${version}";
hash = "sha256-K0EfKG140MDfSg3BVJi9x0q1it5nEeREpkanx2RW1Kw=";
};
# We have to use importCargoLock here because `cargo vendor` currently doesn't support workspace
# inheritance within Git dependencies, but importCargoLock does.
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"libcst-0.1.0" = "sha256-jG9jYJP4reACkFLrQBWOYH6nbKniNyFVItD0cTZ+nW0=";
"pep440_rs-0.2.0" = "sha256-wDJGz7SbHItYsg0+EgIoH48WFdV6MEg+HkeE07JE6AU=";
"rustpython-ast-0.2.0" = "sha256-0SHtycgDVOtiz7JZwd1v9lv2exxemcntm9lciih+pgc=";
"unicode_names2-0.6.0" = "sha256-eWg9+ISm/vztB0KIdjhq5il2ZnwGJQCleCYfznCI3Wg=";
};
};
nativeBuildInputs = [
installShellFiles
];
buildInputs = lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.CoreServices
];
cargoBuildFlags = [ "--package=ruff_cli" ];
# building tests fails with `undefined symbols`
doCheck = false;
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)
'';
meta = with lib; {
description = "An extremely fast Python linter";
homepage = "https://github.com/charliermarsh/ruff";
changelog = "https://github.com/charliermarsh/ruff/releases/tag/v${version}";
license = licenses.mit;
maintainers = with maintainers; [ figsoda ];
};
}