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