2021-06-04 09:07:49 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, rustPlatform, CoreServices, cmake
|
2021-04-12 18:23:04 +00:00
|
|
|
, libiconv
|
|
|
|
, useMimalloc ? false
|
2021-06-28 23:13:55 +00:00
|
|
|
# FIXME: Test doesn't pass under rustc 1.52.1 due to different escaping of `'` in string.
|
|
|
|
, doCheck ? false
|
2021-04-12 18:23:04 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-04-13 19:44:15 +00:00
|
|
|
rustPlatform.buildRustPackage rec {
|
2021-04-12 18:23:04 +00:00
|
|
|
pname = "rust-analyzer-unwrapped";
|
2021-07-14 22:03:04 +00:00
|
|
|
version = "2021-07-12";
|
|
|
|
cargoSha256 = "sha256-wlo3GlB9OhyVXys5pHAqWPKHWZHzNjcQ0hiaYnp2SUc=";
|
2021-04-12 18:23:04 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "rust-analyzer";
|
|
|
|
repo = "rust-analyzer";
|
2021-04-13 19:44:15 +00:00
|
|
|
rev = version;
|
2021-07-14 22:03:04 +00:00
|
|
|
sha256 = "sha256-nd8valnltycywxBObSVFbt4fySEYQknFsFf5ZnEbgOk=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-04-12 18:23:04 +00:00
|
|
|
buildAndTestSubdir = "crates/rust-analyzer";
|
|
|
|
|
|
|
|
cargoBuildFlags = lib.optional useMimalloc "--features=mimalloc";
|
|
|
|
|
|
|
|
nativeBuildInputs = lib.optional useMimalloc cmake;
|
|
|
|
|
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [
|
|
|
|
CoreServices
|
|
|
|
libiconv
|
|
|
|
];
|
|
|
|
|
2021-04-13 19:44:15 +00:00
|
|
|
RUST_ANALYZER_REV = version;
|
2021-04-12 18:23:04 +00:00
|
|
|
|
|
|
|
inherit doCheck;
|
|
|
|
preCheck = lib.optionalString doCheck ''
|
|
|
|
export RUST_SRC_PATH=${rustPlatform.rustLibSrc}
|
|
|
|
'';
|
|
|
|
|
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase = ''
|
|
|
|
runHook preInstallCheck
|
|
|
|
versionOutput="$($out/bin/rust-analyzer --version)"
|
|
|
|
echo "'rust-analyzer --version' returns: $versionOutput"
|
2021-04-13 19:44:15 +00:00
|
|
|
[[ "$versionOutput" == "rust-analyzer ${version}" ]]
|
2021-04-12 18:23:04 +00:00
|
|
|
runHook postInstallCheck
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru.updateScript = ./update.sh;
|
|
|
|
|
|
|
|
meta = with 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 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|