nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 22.05 53 lines 1.7 kB view raw
1{ lib, stdenv, makeWrapper, fetchFromGitHub, rustPlatform 2, openssh, openssl, pkg-config, cmake, zlib, curl, libiconv 3, CoreFoundation, Security, SystemConfiguration }: 4 5rustPlatform.buildRustPackage rec { 6 pname = "rls"; 7 inherit (rustPlatform.rust.rustc) src version; 8 9 # changes hash of vendor directory otherwise 10 dontUpdateAutotoolsGnuConfigScripts = true; 11 12 cargoVendorDir = "vendor"; 13 buildAndTestSubdir = "src/tools/rls"; 14 15 preBuild = '' 16 # client tests are flaky 17 rm ${buildAndTestSubdir}/tests/client.rs 18 ''; 19 20 # a nightly compiler is required unless we use this cheat code. 21 RUSTC_BOOTSTRAP=1; 22 23 # As of rustc 1.45.0, these env vars are required to build rls 24 # (due to https://github.com/rust-lang/rust/pull/72001) 25 CFG_RELEASE = "${rustPlatform.rust.rustc.version}-nightly"; 26 CFG_RELEASE_CHANNEL = "nightly"; 27 28 # rls-rustc links to rustc_private crates 29 CARGO_BUILD_RUSTFLAGS = if stdenv.isDarwin then "-C rpath" else null; 30 31 nativeBuildInputs = [ pkg-config cmake makeWrapper ]; 32 buildInputs = [ openssh openssl curl zlib libiconv rustPlatform.rust.rustc.llvm ] 33 ++ lib.optionals stdenv.isDarwin [ CoreFoundation Security SystemConfiguration ]; 34 35 doCheck = true; 36 37 doInstallCheck = true; 38 installCheckPhase = '' 39 $out/bin/rls --version 40 ''; 41 42 RUST_SRC_PATH = rustPlatform.rustLibSrc; 43 postInstall = '' 44 wrapProgram $out/bin/rls --set-default RUST_SRC_PATH ${rustPlatform.rustLibSrc} 45 ''; 46 47 meta = with lib; { 48 description = "Rust Language Server - provides information about Rust programs to IDEs and other tools"; 49 homepage = "https://github.com/rust-lang/rls/"; 50 license = with licenses; [ asl20 /* or */ mit ]; 51 maintainers = with maintainers; [ symphorien ]; 52 }; 53}