From 68060f6f6f491201724192ea0997d67dbeb2e302 Mon Sep 17 00:00:00 2001 From: oxalica Date: Sat, 7 Nov 2020 00:31:25 +0800 Subject: [PATCH] makeRustPlatform: add rustLibSrc rust-analyzer: rustcSrc -> rustLibSrc to fix build --- .../development/compilers/rust/make-rust-platform.nix | 4 ++++ pkgs/development/compilers/rust/rust-lib-src.nix | 11 +++++++++++ pkgs/development/tools/rust/rust-analyzer/generic.nix | 2 +- pkgs/development/tools/rust/rust-analyzer/wrapper.nix | 5 +++-- 4 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 pkgs/development/compilers/rust/rust-lib-src.nix diff --git a/pkgs/development/compilers/rust/make-rust-platform.nix b/pkgs/development/compilers/rust/make-rust-platform.nix index 6a827cff9a157b..4b1f572bebb88a 100644 --- a/pkgs/development/compilers/rust/make-rust-platform.nix +++ b/pkgs/development/compilers/rust/make-rust-platform.nix @@ -18,4 +18,8 @@ rec { rustcSrc = callPackage ./rust-src.nix { inherit rustc; }; + + rustLibSrc = callPackage ./rust-lib-src.nix { + inherit rustc; + }; } diff --git a/pkgs/development/compilers/rust/rust-lib-src.nix b/pkgs/development/compilers/rust/rust-lib-src.nix new file mode 100644 index 00000000000000..67a7fa3641ad29 --- /dev/null +++ b/pkgs/development/compilers/rust/rust-lib-src.nix @@ -0,0 +1,11 @@ +{ stdenv, rustc }: + +stdenv.mkDerivation { + name = "rust-lib-src"; + src = rustc.src; + phases = [ "unpackPhase" "installPhase" ]; + + installPhase = '' + mv library $out + ''; +} diff --git a/pkgs/development/tools/rust/rust-analyzer/generic.nix b/pkgs/development/tools/rust/rust-analyzer/generic.nix index cbcab33e0db34f..1bab5b9518373d 100644 --- a/pkgs/development/tools/rust/rust-analyzer/generic.nix +++ b/pkgs/development/tools/rust/rust-analyzer/generic.nix @@ -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; diff --git a/pkgs/development/tools/rust/rust-analyzer/wrapper.nix b/pkgs/development/tools/rust/rust-analyzer/wrapper.nix index 8ca3ff1a6d2020..bed20628182650 100644 --- a/pkgs/development/tools/rust/rust-analyzer/wrapper.nix +++ b/pkgs/development/tools/rust/rust-analyzer/wrapper.nix @@ -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}" '')