makeRustPlatform: add rustLibSrc

rust-analyzer: rustcSrc -> rustLibSrc to fix build
This commit is contained in:
oxalica 2020-11-07 00:31:25 +08:00
parent 7ac7ce8b1a
commit 68060f6f6f
No known key found for this signature in database
GPG key ID: CED392DE0C483D00
4 changed files with 19 additions and 3 deletions

View file

@ -18,4 +18,8 @@ rec {
rustcSrc = callPackage ./rust-src.nix {
inherit rustc;
};
rustLibSrc = callPackage ./rust-lib-src.nix {
inherit rustc;
};
}

View file

@ -0,0 +1,11 @@
{ stdenv, rustc }:
stdenv.mkDerivation {
name = "rust-lib-src";
src = rustc.src;
phases = [ "unpackPhase" "installPhase" ];
installPhase = ''
mv library $out
'';
}

View file

@ -29,7 +29,7 @@ rustPlatform.buildRustPackage {
inherit doCheck;
preCheck = lib.optionalString doCheck ''
export RUST_SRC_PATH=${rustPlatform.rustcSrc}
export RUST_SRC_PATH=${rustPlatform.rustLibSrc}
'';
doInstallCheck = true;

View file

@ -4,7 +4,8 @@ lib.makeOverridable ({
unwrapped,
pname ? "rust-analyzer",
version ? unwrapped.version,
rustcSrc ? rustPlatform.rustcSrc,
# Use name from `RUST_SRC_PATH`
rustSrc ? rustPlatform.rustLibSrc,
}: runCommandNoCC "${pname}-${version}" {
inherit pname version;
inherit (unwrapped) src meta;
@ -12,5 +13,5 @@ lib.makeOverridable ({
} ''
mkdir -p $out/bin
makeWrapper ${unwrapped}/bin/rust-analyzer $out/bin/rust-analyzer \
--set-default RUST_SRC_PATH "${rustcSrc}"
--set-default RUST_SRC_PATH "${rustSrc}"
'')