summary refs log tree commit diff
path: root/pkgs/development/tools/rust/rust-analyzer/generic.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/tools/rust/rust-analyzer/generic.nix')
-rw-r--r--pkgs/development/tools/rust/rust-analyzer/generic.nix17
1 files changed, 13 insertions, 4 deletions
diff --git a/pkgs/development/tools/rust/rust-analyzer/generic.nix b/pkgs/development/tools/rust/rust-analyzer/generic.nix
index de755ec17ff..7092f5291dd 100644
--- a/pkgs/development/tools/rust/rust-analyzer/generic.nix
+++ b/pkgs/development/tools/rust/rust-analyzer/generic.nix
@@ -15,9 +15,7 @@ rustPlatform.buildRustPackage {
     inherit rev sha256;
   };
 
-  preBuild = "pushd crates/rust-analyzer";
-  # Do not checking other crates in checkPhase.
-  preInstall = "popd";
+  buildAndTestSubdir = "crates/rust-analyzer";
 
   cargoBuildFlags = lib.optional useJemalloc "--features=jemalloc";
 
@@ -26,6 +24,8 @@ rustPlatform.buildRustPackage {
   buildInputs = lib.optionals stdenv.hostPlatform.isDarwin
     [ darwin.apple_sdk.frameworks.CoreServices ];
 
+  RUST_ANALYZER_REV = rev;
+
   inherit doCheck;
   # Skip tests running `rustup` for `cargo fmt`.
   preCheck = ''
@@ -35,11 +35,20 @@ rustPlatform.buildRustPackage {
     export RUST_SRC_PATH=${rustPlatform.rustcSrc}
   '';
 
+  # Temporary disabled until #93119 is fixed.
+  doInstallCheck = false;
+  installCheckPhase = ''
+    runHook preInstallCheck
+    versionOutput="$($out/bin/rust-analyzer --version)"
+    echo "'rust-analyzer --version' returns: $versionOutput"
+    [[ "$versionOutput" == "rust-analyzer ${rev}" ]]
+    runHook postInstallCheck
+  '';
+
   meta = with stdenv.lib; {
     description = "An experimental modular compiler frontend for the Rust language";
     homepage = "https://github.com/rust-analyzer/rust-analyzer";
     license = with licenses; [ mit asl20 ];
     maintainers = with maintainers; [ oxalica ];
-    platforms = platforms.all;
   };
 }