3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #161533 from Stunkymonkey/rust-{lib-}src-phases

rust-{lib-}src: deprecate phases
This commit is contained in:
zowoq 2022-03-10 13:22:07 +10:00 committed by GitHub
commit 5625298330
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 37 deletions

View file

@ -1,4 +1,4 @@
{ buildPackages, callPackage, stdenv }@prev:
{ buildPackages, callPackage, stdenv, runCommand }@prev:
{ rustc, cargo, stdenv ? prev.stdenv, ... }:
@ -21,11 +21,11 @@ rec {
importCargoLock = buildPackages.callPackage ../../../build-support/rust/import-cargo-lock.nix {};
rustcSrc = callPackage ./rust-src.nix {
inherit stdenv rustc;
inherit runCommand rustc;
};
rustLibSrc = callPackage ./rust-lib-src.nix {
inherit stdenv rustc;
inherit runCommand rustc;
};
# Hooks

View file

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

View file

@ -1,25 +1,21 @@
{ lib, stdenv, rustc, minimalContent ? true }:
{ lib, runCommand, rustc, minimalContent ? true }:
stdenv.mkDerivation {
name = "rust-src";
src = rustc.src;
phases = [ "unpackPhase" "installPhase" ];
installPhase = ''
mv src $out
rm -rf $out/{${lib.concatStringsSep "," ([
"ci"
"doc"
"etc"
"grammar"
"llvm-project"
"llvm-emscripten"
"rtstartup"
"rustllvm"
"test"
"vendor"
] ++ lib.optionals minimalContent [
"tools"
"stdarch"
])}}
'';
}
runCommand "rust-src" { } ''
tar -xzf ${rustc.src}
mv rustc-${rustc.version}-src $out
rm -rf $out/{${lib.concatStringsSep "," ([
"ci"
"doc"
"etc"
"grammar"
"llvm-project"
"llvm-emscripten"
"rtstartup"
"rustllvm"
"test"
"vendor"
] ++ lib.optionals minimalContent [
"tools"
"stdarch"
])}}
''