nix: add ruff.nix (v16.0.1)
This commit is contained in:
parent
39c9086472
commit
81aeff6b4e
2 changed files with 76 additions and 1 deletions
75
nix/ruff.nix
Normal file
75
nix/ruff.nix
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
{
|
||||
lib,
|
||||
stdenv,
|
||||
rustPlatform,
|
||||
fetchFromGitHub,
|
||||
installShellFiles,
|
||||
|
||||
rust-jemalloc-sys,
|
||||
buildPackages,
|
||||
versionCheckHook,
|
||||
|
||||
nixosTests,
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "ruff";
|
||||
version = "0.16.1";
|
||||
|
||||
__structuredAttrs = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "astral-sh";
|
||||
repo = "ruff";
|
||||
tag = version;
|
||||
hash = "sha256-77h1f8LV9ZTYqs5SymLij6CXe3TzrXEMcCPASOHj/UU=";
|
||||
};
|
||||
|
||||
cargoBuildFlags = [ "--package=ruff" ];
|
||||
|
||||
cargoHash = "sha256-fgcl0JhGkzbXD+ajDdIwnIUHEuKj3XwDH81JkDEqntc=";
|
||||
|
||||
nativeBuildInputs = [ installShellFiles ];
|
||||
|
||||
buildInputs = [ rust-jemalloc-sys ];
|
||||
|
||||
# Run cargo tests
|
||||
checkType = "debug";
|
||||
|
||||
# tests do not appear to respect linker options on doctests
|
||||
# Upstream issue: https://github.com/rust-lang/cargo/issues/14189
|
||||
# This causes errors like "error: linker `cc` not found" on static builds
|
||||
doCheck = !stdenv.hostPlatform.isStatic;
|
||||
|
||||
# Exclude tests from `ty`-related crates, run everything else.
|
||||
# Ordinarily we would run all the tests, but there is significant overlap with the `ty` package in nixpkgs,
|
||||
# which ruff shares a monorepo with.
|
||||
# As such, we leave running `ty` tests to the `ty` package, and concentrate on everything else.
|
||||
cargoTestFlags = [
|
||||
"--workspace"
|
||||
"--exclude=ty"
|
||||
"--exclude=ty_ide"
|
||||
"--exclude=ty_project"
|
||||
"--exclude=ty_python_semantic"
|
||||
"--exclude=ty_server"
|
||||
"--exclude=ty_static"
|
||||
"--exclude=ty_test"
|
||||
"--exclude=ty_vendored"
|
||||
"--exclude=ty_wasm"
|
||||
];
|
||||
|
||||
nativeInstallCheckInputs = [ versionCheckHook ];
|
||||
doInstallCheck = true;
|
||||
|
||||
meta = {
|
||||
description = "Extremely fast Python linter and code formatter";
|
||||
homepage = "https://github.com/astral-sh/ruff";
|
||||
changelog = "https://github.com/astral-sh/ruff/releases/tag/${version}";
|
||||
license = lib.licenses.mit;
|
||||
mainProgram = "ruff";
|
||||
maintainers = with lib.maintainers; [
|
||||
bengsparks
|
||||
GaetanLepage
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
@ -30,7 +30,7 @@ rec {
|
|||
# which = which;
|
||||
# ctags = universal-ctags;
|
||||
# xclip = xclip;
|
||||
# ruff = ruff;
|
||||
# ruff = callPackage (bdir + /ruff.nix) {};
|
||||
# perl = perl;
|
||||
# netcat = netcat-openbsd;
|
||||
# jq = jq;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue