2024-09-19 14:19:46 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
rustPlatform,
|
|
|
|
fetchFromGitHub,
|
|
|
|
installShellFiles,
|
|
|
|
stdenv,
|
|
|
|
darwin,
|
|
|
|
rust-jemalloc-sys,
|
|
|
|
ruff-lsp,
|
|
|
|
nix-update-script,
|
|
|
|
testers,
|
|
|
|
ruff,
|
2022-09-30 11:47:45 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "ruff";
|
2024-09-26 11:04:55 +00:00
|
|
|
version = "0.6.7";
|
2022-09-30 11:47:45 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2023-07-15 17:15:38 +00:00
|
|
|
owner = "astral-sh";
|
2023-11-16 04:20:00 +00:00
|
|
|
repo = "ruff";
|
2024-07-27 06:49:29 +00:00
|
|
|
rev = "refs/tags/${version}";
|
2024-09-26 11:04:55 +00:00
|
|
|
hash = "sha256-1udxvl98RveGJmnG8kwlecWD9V+BPadA/YE8jbt9jNo=";
|
2022-09-30 11:47:45 +00:00
|
|
|
};
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
cargoLock = {
|
|
|
|
lockFile = ./Cargo.lock;
|
|
|
|
outputHashes = {
|
|
|
|
"lsp-types-0.95.1" = "sha256-8Oh299exWXVi6A39pALOISNfp8XBya8z+KT/Z7suRxQ=";
|
2024-09-19 14:19:46 +00:00
|
|
|
"salsa-0.18.0" = "sha256-EjpCTOB6E7n5oNn1bvzNyznzs0uRJvAXrNsZggk4hgM=";
|
2024-06-05 15:53:02 +00:00
|
|
|
};
|
|
|
|
};
|
2023-02-02 18:25:31 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
2022-09-30 11:47:45 +00:00
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
buildInputs = [
|
|
|
|
rust-jemalloc-sys
|
2024-09-26 11:04:55 +00:00
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.CoreServices ];
|
2022-09-30 11:47:45 +00:00
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
2023-02-02 18:25:31 +00:00
|
|
|
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-24 13:37:59 +00:00
|
|
|
passthru.tests = {
|
|
|
|
inherit ruff-lsp;
|
2024-07-27 06:49:29 +00:00
|
|
|
updateScript = nix-update-script { };
|
2024-06-20 14:57:18 +00:00
|
|
|
version = testers.testVersion { package = ruff; };
|
2023-05-24 13:37:59 +00:00
|
|
|
};
|
|
|
|
|
2024-07-31 10:19:44 +00:00
|
|
|
# Failing on darwin for an unclear reason.
|
|
|
|
# According to the maintainers, those tests are from an experimental crate that isn't actually
|
|
|
|
# used by ruff currently and can thus be safely skipped.
|
2024-09-26 11:04:55 +00:00
|
|
|
checkFlags = lib.optionals stdenv.hostPlatform.isDarwin [
|
2024-07-31 10:19:44 +00:00
|
|
|
"--skip=changed_file"
|
|
|
|
"--skip=changed_metadata"
|
2024-09-19 14:19:46 +00:00
|
|
|
"--skip=changed_versions_file"
|
2024-07-31 10:19:44 +00:00
|
|
|
"--skip=deleted_file"
|
|
|
|
"--skip=directory_deleted"
|
|
|
|
"--skip=directory_moved_to_trash"
|
|
|
|
"--skip=directory_moved_to_workspace"
|
|
|
|
"--skip=directory_renamed"
|
2024-09-19 14:19:46 +00:00
|
|
|
"--skip=hard_links_in_workspace"
|
|
|
|
"--skip=hard_links_to_target_outside_workspace"
|
2024-07-31 10:19:44 +00:00
|
|
|
"--skip=move_file_to_trash"
|
|
|
|
"--skip=move_file_to_workspace"
|
|
|
|
"--skip=new_file"
|
|
|
|
"--skip=new_ignored_file"
|
|
|
|
"--skip=rename_file"
|
|
|
|
"--skip=search_path"
|
2024-09-19 14:19:46 +00:00
|
|
|
"--skip=unix::symlink_inside_workspace"
|
2024-07-31 10:19:44 +00:00
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
meta = {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Extremely fast Python linter";
|
2023-07-15 17:15:38 +00:00
|
|
|
homepage = "https://github.com/astral-sh/ruff";
|
2024-07-27 06:49:29 +00:00
|
|
|
changelog = "https://github.com/astral-sh/ruff/releases/tag/${version}";
|
2024-06-05 15:53:02 +00:00
|
|
|
license = lib.licenses.mit;
|
2023-08-10 07:59:29 +00:00
|
|
|
mainProgram = "ruff";
|
2024-06-05 15:53:02 +00:00
|
|
|
maintainers = with lib.maintainers; [
|
|
|
|
figsoda
|
|
|
|
GaetanLepage
|
|
|
|
];
|
2022-09-30 11:47:45 +00:00
|
|
|
};
|
|
|
|
}
|