summary refs log tree commit diff
path: root/pkgs/development/tools/rust/rust-analyzer/generic.nix
diff options
context:
space:
mode:
authoroxalica <oxalicc@pm.me>2020-06-23 22:30:37 +0800
committeroxalica <oxalicc@pm.me>2020-07-14 20:15:55 +0800
commitddacdbc953ed3cfbd367b9185d6c1826fd58758a (patch)
tree6cb4fdafc9e73585de9c741b27eeae35830aa7fb /pkgs/development/tools/rust/rust-analyzer/generic.nix
parentc90e6dd06d37f20d115872bd6262e1c632d2da34 (diff)
downloadnixpkgs-ddacdbc953ed3cfbd367b9185d6c1826fd58758a.tar
nixpkgs-ddacdbc953ed3cfbd367b9185d6c1826fd58758a.tar.gz
nixpkgs-ddacdbc953ed3cfbd367b9185d6c1826fd58758a.tar.bz2
nixpkgs-ddacdbc953ed3cfbd367b9185d6c1826fd58758a.tar.lz
nixpkgs-ddacdbc953ed3cfbd367b9185d6c1826fd58758a.tar.xz
nixpkgs-ddacdbc953ed3cfbd367b9185d6c1826fd58758a.tar.zst
nixpkgs-ddacdbc953ed3cfbd367b9185d6c1826fd58758a.zip
rust-analyzer: fix version display and add check
Diffstat (limited to 'pkgs/development/tools/rust/rust-analyzer/generic.nix')
-rw-r--r--pkgs/development/tools/rust/rust-analyzer/generic.nix11
1 files changed, 11 insertions, 0 deletions
diff --git a/pkgs/development/tools/rust/rust-analyzer/generic.nix b/pkgs/development/tools/rust/rust-analyzer/generic.nix
index ae6ad80cdd9..d1dab3423bc 100644
--- a/pkgs/development/tools/rust/rust-analyzer/generic.nix
+++ b/pkgs/development/tools/rust/rust-analyzer/generic.nix
@@ -24,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 = ''
@@ -33,6 +35,15 @@ rustPlatform.buildRustPackage {
     export RUST_SRC_PATH=${rustPlatform.rustcSrc}
   '';
 
+  doInstallCheck = true;
+  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";