Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at gcc-offload 31 lines 683 B view raw
1{ 2 lib, 3 stdenv, 4 rustPlatform, 5 buildPackages, 6 originalCargoToml ? null, 7}: 8 9stdenv.mkDerivation { 10 name = "cargo-src"; 11 preferLocalBuild = true; 12 13 unpackPhase = "true"; 14 dontConfigure = true; 15 dontBuild = true; 16 17 installPhase = 18 '' 19 export RUSTC_SRC=${rustPlatform.rustLibSrc.override { }} 20 '' 21 + lib.optionalString (originalCargoToml != null) '' 22 export ORIG_CARGO=${originalCargoToml} 23 '' 24 + '' 25 ${buildPackages.python3.withPackages (ps: with ps; [ toml ])}/bin/python3 ${./cargo.py} 26 mkdir -p $out/src 27 echo '#![no_std]' > $out/src/lib.rs 28 cp Cargo.toml $out/Cargo.toml 29 cp ${./Cargo.lock} $out/Cargo.lock 30 ''; 31}