2021-04-12 18:23:04 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, rustPlatform, CoreServices, cmake
|
|
|
|
, libiconv
|
|
|
|
, useMimalloc ? false
|
|
|
|
, doCheck ? true
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-04-12 18:23:04 +00:00
|
|
|
let
|
|
|
|
rev = "2021-04-05";
|
|
|
|
in
|
2021-03-19 17:17:44 +00:00
|
|
|
|
2021-04-12 18:23:04 +00:00
|
|
|
rustPlatform.buildRustPackage {
|
|
|
|
pname = "rust-analyzer-unwrapped";
|
|
|
|
version = "unstable-${rev}";
|
|
|
|
cargoSha256 = "sha256-kDwdKa08E0h24lOOa7ALeNqHlMjMry/ru1qwCIyKmuE=";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "rust-analyzer";
|
|
|
|
repo = "rust-analyzer";
|
|
|
|
inherit rev;
|
|
|
|
sha256 = "sha256-ZDxy87F3uz8bTF1/2LIy5r4Nv/M3xe97F7mwJNEFcUs=";
|
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
|
|
|
|
];
|
|
|
|
|
|
|
|
RUST_ANALYZER_REV = rev;
|
|
|
|
|
|
|
|
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"
|
|
|
|
[[ "$versionOutput" == "rust-analyzer ${rev}" ]]
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|