2021-10-25 14:26:59 +02:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, rustPlatform
|
|
|
|
, CoreServices
|
|
|
|
, cmake
|
2021-03-16 17:27:10 +01:00
|
|
|
, libiconv
|
2020-09-17 20:33:12 +02:00
|
|
|
, useMimalloc ? false
|
2021-08-24 22:56:02 +02:00
|
|
|
, doCheck ? true
|
2020-09-17 20:33:12 +02:00
|
|
|
}:
|
2020-01-18 20:34:16 +01:00
|
|
|
|
2021-04-12 09:06:42 +02:00
|
|
|
rustPlatform.buildRustPackage rec {
|
2020-01-18 20:34:16 +01:00
|
|
|
pname = "rust-analyzer-unwrapped";
|
2022-05-04 00:44:51 +02:00
|
|
|
version = "2022-05-02";
|
|
|
|
cargoSha256 = "sha256-uZCUruIBTNTKYWYb8xQgJ6FsKlRi+Sh5n7m7aVk+hHQ=";
|
2020-01-18 20:34:16 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2022-05-07 04:20:43 +02:00
|
|
|
owner = "rust-lang";
|
2020-01-18 20:34:16 +01:00
|
|
|
repo = "rust-analyzer";
|
2021-04-12 09:06:42 +02:00
|
|
|
rev = version;
|
2022-05-04 00:44:51 +02:00
|
|
|
sha256 = "sha256-5kAbd/tTc9vkr27ar44hnpXdS0vQg0OLJUMlp0FBjqA=";
|
2020-01-18 20:34:16 +01:00
|
|
|
};
|
|
|
|
|
2021-08-24 22:56:02 +02:00
|
|
|
patches = [
|
|
|
|
# Code format and git history check require more dependencies but don't really matter for packaging.
|
|
|
|
# So just ignore them.
|
|
|
|
./ignore-git-and-rustfmt-tests.patch
|
2021-10-25 14:26:59 +02:00
|
|
|
];
|
2021-09-21 17:18:55 +02:00
|
|
|
|
2020-05-13 01:28:24 +02:00
|
|
|
buildAndTestSubdir = "crates/rust-analyzer";
|
2020-01-18 20:34:16 +01:00
|
|
|
|
2020-09-17 20:33:12 +02:00
|
|
|
nativeBuildInputs = lib.optional useMimalloc cmake;
|
2020-01-18 20:34:16 +01:00
|
|
|
|
2021-03-16 17:27:10 +01:00
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [
|
|
|
|
CoreServices
|
|
|
|
libiconv
|
|
|
|
];
|
2020-01-18 20:34:16 +01:00
|
|
|
|
2021-11-16 01:49:31 +01:00
|
|
|
buildFeatures = lib.optional useMimalloc "mimalloc";
|
|
|
|
|
2021-04-12 09:06:42 +02:00
|
|
|
RUST_ANALYZER_REV = version;
|
2020-06-23 16:30:37 +02:00
|
|
|
|
2020-01-18 20:34:16 +01:00
|
|
|
inherit doCheck;
|
2020-09-17 20:33:12 +02:00
|
|
|
preCheck = lib.optionalString doCheck ''
|
2020-11-06 17:31:25 +01:00
|
|
|
export RUST_SRC_PATH=${rustPlatform.rustLibSrc}
|
2020-01-18 20:34:16 +01:00
|
|
|
'';
|
|
|
|
|
2020-09-17 20:33:12 +02:00
|
|
|
doInstallCheck = true;
|
2020-06-23 16:30:37 +02:00
|
|
|
installCheckPhase = ''
|
|
|
|
runHook preInstallCheck
|
|
|
|
versionOutput="$($out/bin/rust-analyzer --version)"
|
|
|
|
echo "'rust-analyzer --version' returns: $versionOutput"
|
2021-04-12 09:06:42 +02:00
|
|
|
[[ "$versionOutput" == "rust-analyzer ${version}" ]]
|
2020-06-23 16:30:37 +02:00
|
|
|
runHook postInstallCheck
|
|
|
|
'';
|
|
|
|
|
2021-02-22 13:00:24 +01:00
|
|
|
passthru.updateScript = ./update.sh;
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2021-11-30 21:54:05 +01:00
|
|
|
description = "A modular compiler frontend for the Rust language";
|
|
|
|
homepage = "https://rust-analyzer.github.io";
|
2020-01-18 20:34:16 +01:00
|
|
|
license = with licenses; [ mit asl20 ];
|
|
|
|
maintainers = with maintainers; [ oxalica ];
|
2022-05-05 02:46:39 +02:00
|
|
|
mainProgram = "rust-analyzer";
|
2020-01-18 20:34:16 +01:00
|
|
|
};
|
|
|
|
}
|