2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, makeWrapper, fetchFromGitHub, rustPlatform
|
|
|
|
, openssh, openssl, pkg-config, cmake, zlib, curl, libiconv
|
2020-04-24 23:36:52 +00:00
|
|
|
, CoreFoundation, Security }:
|
|
|
|
|
|
|
|
rustPlatform.buildRustPackage {
|
|
|
|
pname = "rls";
|
|
|
|
inherit (rustPlatform.rust.rustc) src version;
|
|
|
|
|
|
|
|
# changes hash of vendor directory otherwise
|
|
|
|
dontUpdateAutotoolsGnuConfigScripts = true;
|
|
|
|
|
|
|
|
cargoVendorDir = "vendor";
|
2020-06-18 07:06:33 +00:00
|
|
|
buildAndTestSubdir = "src/tools/rls";
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
preBuild = ''
|
|
|
|
# client tests are flaky
|
|
|
|
rm tests/client.rs
|
|
|
|
'';
|
|
|
|
|
|
|
|
# a nightly compiler is required unless we use this cheat code.
|
|
|
|
RUSTC_BOOTSTRAP=1;
|
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
# As of rustc 1.45.0, these env vars are required to build rls
|
|
|
|
# (due to https://github.com/rust-lang/rust/pull/72001)
|
|
|
|
CFG_RELEASE = "${rustPlatform.rust.rustc.version}-nightly";
|
|
|
|
CFG_RELEASE_CHANNEL = "nightly";
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
# rls-rustc links to rustc_private crates
|
|
|
|
CARGO_BUILD_RUSTFLAGS = if stdenv.isDarwin then "-C rpath" else null;
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ pkg-config cmake ];
|
2020-06-18 07:06:33 +00:00
|
|
|
buildInputs = [ openssh openssl curl zlib libiconv makeWrapper rustPlatform.rust.rustc.llvm ]
|
2021-02-05 17:12:51 +00:00
|
|
|
++ (lib.optionals stdenv.isDarwin [ CoreFoundation Security ]);
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase = ''
|
|
|
|
$out/bin/rls --version
|
|
|
|
'';
|
|
|
|
|
2021-01-09 10:05:03 +00:00
|
|
|
RUST_SRC_PATH = rustPlatform.rustLibSrc;
|
2020-06-18 07:06:33 +00:00
|
|
|
postInstall = ''
|
2021-01-09 10:05:03 +00:00
|
|
|
wrapProgram $out/bin/rls --set-default RUST_SRC_PATH ${rustPlatform.rustLibSrc}
|
2020-06-18 07:06:33 +00:00
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Rust Language Server - provides information about Rust programs to IDEs and other tools";
|
|
|
|
homepage = "https://github.com/rust-lang/rls/";
|
|
|
|
license = with licenses; [ asl20 /* or */ mit ];
|
|
|
|
maintainers = with maintainers; [ symphorien ];
|
|
|
|
};
|
|
|
|
}
|