3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/build-support/rust/sysroot/src.nix
John Ericson c9c3de0131 Update script as rust-src layout has changed
Use stub lib so `core` and `alloc` are handled symmetrically.
2021-11-08 20:38:59 +00:00

23 lines
592 B
Nix

{ lib, stdenv, rustPlatform, buildPackages
, originalCargoToml ? null
}:
stdenv.mkDerivation {
name = "cargo-src";
preferLocalBuild = true;
phases = [ "installPhase" ];
installPhase = ''
export RUSTC_SRC=${rustPlatform.rustLibSrc.override { }}
''
+ lib.optionalString (originalCargoToml != null) ''
export ORIG_CARGO=${originalCargoToml}
''
+ ''
${buildPackages.python3.withPackages (ps: with ps; [ toml ])}/bin/python3 ${./cargo.py}
mkdir -p $out/src
touch $out/src/lib.rs
cp Cargo.toml $out/Cargo.toml
cp ${./Cargo.lock} $out/Cargo.lock
'';
}