Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib 2, rustPlatform 3, fetchFromGitHub 4, installShellFiles 5, stdenv 6, darwin 7 # tests 8, ruff-lsp 9}: 10 11rustPlatform.buildRustPackage rec { 12 pname = "ruff"; 13 version = "0.0.270"; 14 15 src = fetchFromGitHub { 16 owner = "charliermarsh"; 17 repo = pname; 18 rev = "v${version}"; 19 hash = "sha256-rruNNP/VkvMQexQ+V/ASxl5flHt00YomMAVzW+eWp20="; 20 }; 21 22 cargoLock = { 23 lockFile = ./Cargo.lock; 24 outputHashes = { 25 "libcst-0.1.0" = "sha256-jG9jYJP4reACkFLrQBWOYH6nbKniNyFVItD0cTZ+nW0="; 26 "ruff_text_size-0.0.0" = "sha256-hiM4+YAb0UUt8mUoKhMqTAiR3hCyoRMyEDe6di6Ohrc="; 27 "unicode_names2-0.6.0" = "sha256-eWg9+ISm/vztB0KIdjhq5il2ZnwGJQCleCYfznCI3Wg="; 28 }; 29 }; 30 31 nativeBuildInputs = [ 32 installShellFiles 33 ]; 34 35 buildInputs = lib.optionals stdenv.isDarwin [ 36 darwin.apple_sdk.frameworks.CoreServices 37 ]; 38 39 cargoBuildFlags = [ "--package=ruff_cli" ]; 40 cargoTestFlags = cargoBuildFlags; 41 42 preBuild = lib.optionalString (stdenv.isDarwin && stdenv.isx86_64) '' 43 # See https://github.com/jemalloc/jemalloc/issues/1997 44 # Using a value of 48 should work on both emulated and native x86_64-darwin. 45 export JEMALLOC_SYS_WITH_LG_VADDR=48 46 ''; 47 48 postInstall = '' 49 installShellCompletion --cmd ruff \ 50 --bash <($out/bin/ruff generate-shell-completion bash) \ 51 --fish <($out/bin/ruff generate-shell-completion fish) \ 52 --zsh <($out/bin/ruff generate-shell-completion zsh) 53 ''; 54 55 passthru.tests = { 56 inherit ruff-lsp; 57 }; 58 59 meta = with lib; { 60 description = "An extremely fast Python linter"; 61 homepage = "https://github.com/charliermarsh/ruff"; 62 changelog = "https://github.com/charliermarsh/ruff/releases/tag/v${version}"; 63 license = licenses.mit; 64 maintainers = with maintainers; [ figsoda ]; 65 }; 66}