parameterize rustcSrc

This commit is contained in:
Aaron Janse 2020-10-15 17:27:51 -07:00
parent a153be896f
commit d906fda8d2
2 changed files with 6 additions and 3 deletions

View File

@ -8,7 +8,7 @@ let
preferLocalBuild = true;
phases = [ "installPhase" ];
installPhase = ''
RUSTC_SRC=${rustPlatform.rustcSrc} ORIG_CARGO=${originalCargoToml} \
RUSTC_SRC=${rustPlatform.rustcSrc.override { minimalContent = false; }} ORIG_CARGO=${originalCargoToml} \
${buildPackages.python3.withPackages (ps: with ps; [ toml ])}/bin/python3 ${./cargo.py}
mkdir -p $out
cp Cargo.toml $out/Cargo.toml

View File

@ -1,4 +1,4 @@
{ stdenv, rustc }:
{ lib, stdenv, rustc, minimalContent ? true }:
stdenv.mkDerivation {
name = "rust-src";
@ -6,6 +6,9 @@ stdenv.mkDerivation {
phases = [ "unpackPhase" "installPhase" ];
installPhase = ''
mv src $out
rm -rf $out/{ci,doc,etc,grammar,llvm-project,llvm-emscripten,rtstartup,rustllvm,test,vendor}
rm -rf $out/{${if minimalContent
then "ci,doc,etc,grammar,llvm-project,llvm-emscripten,rtstartup,rustllvm,test,tools,vendor,stdarch"
else "ci,doc,etc,grammar,llvm-project,llvm-emscripten,rtstartup,rustllvm,test,vendor"
}}
'';
}