From d906fda8d2b467e16d1b41842bf3b63aee3da449 Mon Sep 17 00:00:00 2001 From: Aaron Janse Date: Thu, 15 Oct 2020 17:27:51 -0700 Subject: [PATCH] parameterize rustcSrc --- pkgs/build-support/rust/sysroot/default.nix | 2 +- pkgs/development/compilers/rust/rust-src.nix | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pkgs/build-support/rust/sysroot/default.nix b/pkgs/build-support/rust/sysroot/default.nix index de82f2bf30af..c32b6577e35c 100644 --- a/pkgs/build-support/rust/sysroot/default.nix +++ b/pkgs/build-support/rust/sysroot/default.nix @@ -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 diff --git a/pkgs/development/compilers/rust/rust-src.nix b/pkgs/development/compilers/rust/rust-src.nix index db48d9a95df6..54691f5fdf08 100644 --- a/pkgs/development/compilers/rust/rust-src.nix +++ b/pkgs/development/compilers/rust/rust-src.nix @@ -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" + }} ''; }