14 rustPlatform.buildRustPackage rec {
15 pname = "rust-analyzer-unwrapped";
16 version = "2024-04-08";
17 cargoSha256 = "sha256-lVVHp8kbi3bnDQ0lCZugGSNznJduXPftGDq7ByxXWgc=";
19 src = fetchFromGitHub {
21 repo = "rust-analyzer";
23 sha256 = "sha256-St7ZQrkrr5lmQX9wC1ZJAFxL8W7alswnyZk9d1se3Us=";
26 cargoBuildFlags = [ "--bin" "rust-analyzer" "--bin" "rust-analyzer-proc-macro-srv" ];
27 cargoTestFlags = [ "--package" "rust-analyzer" "--package" "proc-macro-srv-cli" ];
29 # Code format check requires more dependencies but don't really matter for packaging.
31 checkFlags = [ "--skip=tidy::check_code_formatting" ];
33 nativeBuildInputs = lib.optional useMimalloc cmake;
35 buildInputs = lib.optionals stdenv.isDarwin [
40 buildFeatures = lib.optional useMimalloc "mimalloc";
42 CFG_RELEASE = version;
45 preCheck = lib.optionalString doCheck ''
46 export RUST_SRC_PATH=${rustPlatform.rustLibSrc}
49 doInstallCheck = true;
50 installCheckPhase = ''
51 runHook preInstallCheck
52 versionOutput="$($out/bin/rust-analyzer --version)"
53 echo "'rust-analyzer --version' returns: $versionOutput"
54 [[ "$versionOutput" == "rust-analyzer ${version}" ]]
55 runHook postInstallCheck
59 updateScript = nix-update-script { };
60 # FIXME: Pass overrided `rust-analyzer` once `buildRustPackage` also implements #119942
61 tests.neovim-lsp = callPackage ./test-neovim-lsp.nix { };
65 description = "A modular compiler frontend for the Rust language";
66 homepage = "https://rust-analyzer.github.io";
67 license = with licenses; [ mit asl20 ];
68 maintainers = with maintainers; [ oxalica ];
69 mainProgram = "rust-analyzer";