Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at fix-function-merge 86 lines 2.3 kB view raw
1{ lib 2, rustPlatform 3, fetchFromGitHub 4, installShellFiles 5, stdenv 6, darwin 7, rust-jemalloc-sys 8, ruff-lsp 9, nix-update-script 10, testers 11, ruff 12}: 13 14rustPlatform.buildRustPackage rec { 15 pname = "ruff"; 16 version = "0.5.5"; 17 18 src = fetchFromGitHub { 19 owner = "astral-sh"; 20 repo = "ruff"; 21 rev = "refs/tags/${version}"; 22 hash = "sha256-dqfK6YdAV4cdUYB8bPE9I5FduBJ90RxUA7TMvcVq6Zw="; 23 }; 24 25 cargoLock = { 26 lockFile = ./Cargo.lock; 27 outputHashes = { 28 "lsp-types-0.95.1" = "sha256-8Oh299exWXVi6A39pALOISNfp8XBya8z+KT/Z7suRxQ="; 29 "salsa-0.18.0" = "sha256-gcaAsrrJXrWOIHUnfBwwuTBG1Mb+lUEmIxSGIVLhXaM="; 30 }; 31 }; 32 33 nativeBuildInputs = [ 34 installShellFiles 35 ]; 36 37 buildInputs = [ 38 rust-jemalloc-sys 39 ] ++ lib.optionals stdenv.isDarwin [ 40 darwin.apple_sdk.frameworks.CoreServices 41 ]; 42 43 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' 44 installShellCompletion --cmd ruff \ 45 --bash <($out/bin/ruff generate-shell-completion bash) \ 46 --fish <($out/bin/ruff generate-shell-completion fish) \ 47 --zsh <($out/bin/ruff generate-shell-completion zsh) 48 ''; 49 50 passthru.tests = { 51 inherit ruff-lsp; 52 updateScript = nix-update-script { }; 53 version = testers.testVersion { package = ruff; }; 54 }; 55 56 # Failing on darwin for an unclear reason. 57 # According to the maintainers, those tests are from an experimental crate that isn't actually 58 # used by ruff currently and can thus be safely skipped. 59 checkFlags = lib.optionals stdenv.isDarwin [ 60 "--skip=changed_file" 61 "--skip=changed_metadata" 62 "--skip=deleted_file" 63 "--skip=directory_deleted" 64 "--skip=directory_moved_to_trash" 65 "--skip=directory_moved_to_workspace" 66 "--skip=directory_renamed" 67 "--skip=move_file_to_trash" 68 "--skip=move_file_to_workspace" 69 "--skip=new_file" 70 "--skip=new_ignored_file" 71 "--skip=rename_file" 72 "--skip=search_path" 73 ]; 74 75 meta = { 76 description = "Extremely fast Python linter"; 77 homepage = "https://github.com/astral-sh/ruff"; 78 changelog = "https://github.com/astral-sh/ruff/releases/tag/${version}"; 79 license = lib.licenses.mit; 80 mainProgram = "ruff"; 81 maintainers = with lib.maintainers; [ 82 figsoda 83 GaetanLepage 84 ]; 85 }; 86}