2020-09-25 04:45:31 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, rustPlatform, darwin, cmake
|
|
|
|
, useMimalloc ? false
|
2020-04-24 23:36:52 +00:00
|
|
|
, doCheck ? true
|
|
|
|
|
|
|
|
# Version specific args
|
2020-09-25 04:45:31 +00:00
|
|
|
, rev, version, sha256, cargoSha256
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
rustPlatform.buildRustPackage {
|
|
|
|
pname = "rust-analyzer-unwrapped";
|
|
|
|
inherit version cargoSha256;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "rust-analyzer";
|
|
|
|
repo = "rust-analyzer";
|
|
|
|
inherit rev sha256;
|
|
|
|
};
|
|
|
|
|
2020-06-18 07:06:33 +00:00
|
|
|
buildAndTestSubdir = "crates/rust-analyzer";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
cargoBuildFlags = lib.optional useMimalloc "--features=mimalloc";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
nativeBuildInputs = lib.optional useMimalloc cmake;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin
|
|
|
|
[ darwin.apple_sdk.frameworks.CoreServices ];
|
|
|
|
|
2020-07-18 16:06:22 +00:00
|
|
|
RUST_ANALYZER_REV = rev;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
inherit doCheck;
|
2020-09-25 04:45:31 +00:00
|
|
|
preCheck = lib.optionalString doCheck ''
|
2020-11-09 15:59:12 +00:00
|
|
|
export RUST_SRC_PATH=${rustPlatform.rustLibSrc}
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
doInstallCheck = true;
|
2020-07-18 16:06:22 +00:00
|
|
|
installCheckPhase = ''
|
|
|
|
runHook preInstallCheck
|
|
|
|
versionOutput="$($out/bin/rust-analyzer --version)"
|
|
|
|
echo "'rust-analyzer --version' returns: $versionOutput"
|
|
|
|
[[ "$versionOutput" == "rust-analyzer ${rev}" ]]
|
|
|
|
runHook postInstallCheck
|
|
|
|
'';
|
|
|
|
|
2021-02-22 21:28:39 +00:00
|
|
|
passthru.updateScript = ./update.sh;
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|