mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-02 03:43:06 +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" ```
79 lines
1.8 KiB
Nix
79 lines
1.8 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
python3,
|
|
fetchFromGitHub,
|
|
|
|
# nativeCheckInputs
|
|
ruff,
|
|
|
|
# passthru
|
|
nix-update-script,
|
|
testers,
|
|
ruff-lsp,
|
|
}:
|
|
|
|
python3.pkgs.buildPythonApplication rec {
|
|
pname = "ruff-lsp";
|
|
version = "0.0.57";
|
|
pyproject = true;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "astral-sh";
|
|
repo = "ruff-lsp";
|
|
rev = "refs/tags/v${version}";
|
|
hash = "sha256-w9NNdsDD+YLrCw8DHDhVx62MdwLhcN8QSmb/2rqlb5g=";
|
|
};
|
|
|
|
postPatch = ''
|
|
# ruff binary added to PATH in wrapper so it's not needed
|
|
sed -i '/"ruff>=/d' pyproject.toml
|
|
'';
|
|
|
|
build-system = with python3.pkgs; [ hatchling ];
|
|
|
|
dependencies = with python3.pkgs; [
|
|
packaging
|
|
pygls
|
|
lsprotocol
|
|
typing-extensions
|
|
];
|
|
|
|
# fails in linux sandbox
|
|
doCheck = stdenv.hostPlatform.isDarwin;
|
|
|
|
nativeCheckInputs = with python3.pkgs; [
|
|
pytestCheckHook
|
|
pytest-asyncio
|
|
python-lsp-jsonrpc
|
|
ruff
|
|
];
|
|
|
|
makeWrapperArgs = [
|
|
# prefer ruff from user's PATH, that's usually desired behavior
|
|
"--suffix PATH : ${lib.makeBinPath [ ruff ]}"
|
|
|
|
# Unset ambient PYTHONPATH in the wrapper, so ruff-lsp only ever runs with
|
|
# its own, isolated set of dependencies. This works because the correct
|
|
# PYTHONPATH is set in the Python script, which runs after the wrapper.
|
|
"--unset PYTHONPATH"
|
|
];
|
|
|
|
passthru = {
|
|
updateScript = nix-update-script { };
|
|
tests.version = testers.testVersion { package = ruff-lsp; };
|
|
};
|
|
|
|
meta = {
|
|
changelog = "https://github.com/astral-sh/ruff-lsp/releases/tag/v${version}";
|
|
description = "Language Server Protocol implementation for Ruff";
|
|
homepage = "https://github.com/astral-sh/ruff-lsp";
|
|
license = lib.licenses.mit;
|
|
mainProgram = "ruff-lsp";
|
|
maintainers = with lib.maintainers; [
|
|
figsoda
|
|
kalekseev
|
|
];
|
|
};
|
|
}
|