Wrap cargo-miri for rust-src

wip/nixpkgs-raku
oxalica 3 years ago
parent 80287ab66a
commit 0565a346c1
  1. 11
      cargo-miri-wrapper.sh
  2. 10
      rust-overlay.nix

@ -0,0 +1,11 @@
#!@bash@ -e
src_dir="@out@/lib/rustlib/src/rust/library"
if [[ ! -v XARGO_RUST_SRC ]]; then
if [[ ! -d "$src_dir" ]]; then
echo '`rust-src` is required by miri but not installed.' >&2
echo 'Please either install component `rust-src` or set `XARGO_RUST_SRC`.' >&2
exit 1
fi
export XARGO_RUST_SRC="$src_dir"
fi
exec -a "$0" "@miri@" "$@"

@ -253,6 +253,16 @@ let
cp --remove-destination "$(realpath -e $target)" $target
fi
done
if [ -e $out/bin/cargo-miri ]; then
cargo_miri=$(readlink $out/bin/cargo-miri)
cp -f ${./cargo-miri-wrapper.sh} $out/bin/cargo-miri
chmod +w $out/bin/cargo-miri
substituteInPlace $out/bin/cargo-miri \
--replace "@bash@" "${self.pkgs.bash}/bin/bash" \
--replace "@miri@" "$cargo_miri" \
--replace "@out@" "$out"
fi
'';
# Add the compiler as part of the propagated build inputs in order

Loading…
Cancel
Save