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

48 lines
1.1 KiB
Nix

{ lib
, rustPlatform
, fetchFromGitHub
, installShellFiles
, stdenv
, darwin
}:
rustPlatform.buildRustPackage rec {
pname = "ruff";
version = "0.0.244";
src = fetchFromGitHub {
owner = "charliermarsh";
repo = pname;
rev = "v${version}";
sha256 = "sha256-oQBNVs7hoiXNqz5lYq5YNKHfpQ/c8LZAvNvtFqpTM2E=";
};
cargoSha256 = "sha256-61kypAXWfUZLfTbSp+b0gCKwuWtxAYVtKIwfVOcJ2o8=";
nativeBuildInputs = [
installShellFiles
];
buildInputs = lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.CoreServices
];
# 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 ];
};
}