2021-12-06 16:07:01 +00:00
|
|
|
{ lib, stdenv, rustPlatform, buildPackages
|
|
|
|
, originalCargoToml ? null
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "cargo-src";
|
|
|
|
preferLocalBuild = true;
|
|
|
|
|
|
|
|
unpackPhase = "true";
|
|
|
|
dontConfigure = true;
|
|
|
|
dontBuild = true;
|
|
|
|
|
|
|
|
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
|
2023-03-27 19:17:25 +00:00
|
|
|
echo '#![no_std]' > $out/src/lib.rs
|
2021-12-06 16:07:01 +00:00
|
|
|
cp Cargo.toml $out/Cargo.toml
|
|
|
|
cp ${./Cargo.lock} $out/Cargo.lock
|
|
|
|
'';
|
|
|
|
}
|