mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-09 14:33:22 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
88 lines
2.4 KiB
Nix
88 lines
2.4 KiB
Nix
{
|
|
lib,
|
|
rustPlatform,
|
|
fetchFromGitHub,
|
|
installShellFiles,
|
|
stdenv,
|
|
darwin,
|
|
rust-jemalloc-sys,
|
|
ruff-lsp,
|
|
nix-update-script,
|
|
testers,
|
|
ruff,
|
|
}:
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "ruff";
|
|
version = "0.6.7";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "astral-sh";
|
|
repo = "ruff";
|
|
rev = "refs/tags/${version}";
|
|
hash = "sha256-1udxvl98RveGJmnG8kwlecWD9V+BPadA/YE8jbt9jNo=";
|
|
};
|
|
|
|
cargoLock = {
|
|
lockFile = ./Cargo.lock;
|
|
outputHashes = {
|
|
"lsp-types-0.95.1" = "sha256-8Oh299exWXVi6A39pALOISNfp8XBya8z+KT/Z7suRxQ=";
|
|
"salsa-0.18.0" = "sha256-EjpCTOB6E7n5oNn1bvzNyznzs0uRJvAXrNsZggk4hgM=";
|
|
};
|
|
};
|
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
buildInputs = [
|
|
rust-jemalloc-sys
|
|
] ++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.CoreServices ];
|
|
|
|
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
|
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;
|
|
updateScript = nix-update-script { };
|
|
version = testers.testVersion { package = ruff; };
|
|
};
|
|
|
|
# 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.
|
|
checkFlags = lib.optionals stdenv.hostPlatform.isDarwin [
|
|
"--skip=changed_file"
|
|
"--skip=changed_metadata"
|
|
"--skip=changed_versions_file"
|
|
"--skip=deleted_file"
|
|
"--skip=directory_deleted"
|
|
"--skip=directory_moved_to_trash"
|
|
"--skip=directory_moved_to_workspace"
|
|
"--skip=directory_renamed"
|
|
"--skip=hard_links_in_workspace"
|
|
"--skip=hard_links_to_target_outside_workspace"
|
|
"--skip=move_file_to_trash"
|
|
"--skip=move_file_to_workspace"
|
|
"--skip=new_file"
|
|
"--skip=new_ignored_file"
|
|
"--skip=rename_file"
|
|
"--skip=search_path"
|
|
"--skip=unix::symlink_inside_workspace"
|
|
];
|
|
|
|
meta = {
|
|
description = "Extremely fast Python linter";
|
|
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; [
|
|
figsoda
|
|
GaetanLepage
|
|
];
|
|
};
|
|
}
|