build: pin JD Cargo to domestic sparse source

This commit is contained in:
冰朔 2026-07-17 19:29:33 +08:00
parent cf22f436de
commit b60b5783f8
2 changed files with 12 additions and 4 deletions

View File

@ -27,10 +27,10 @@ if ! command -v cargo >/dev/null 2>&1; then
export RUSTUP_UPDATE_ROOT="${RUSTUP_UPDATE_ROOT:-https://rsproxy.cn/rustup}"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
fi
export CARGO_REGISTRIES_CRATES_IO_PROTOCOL="${CARGO_REGISTRIES_CRATES_IO_PROTOCOL:-sparse}"
export CARGO_REGISTRIES_CRATES_IO_INDEX="${CARGO_REGISTRIES_CRATES_IO_INDEX:-sparse+https://rsproxy.cn/index/}"
export CARGO_SOURCE_CRATES_IO_REPLACE_WITH="${CARGO_SOURCE_CRATES_IO_REPLACE_WITH:-rsproxy}"
export CARGO_SOURCE_RSPROXY_REGISTRY="${CARGO_SOURCE_RSPROXY_REGISTRY:-sparse+https://rsproxy.cn/index/}"
export CARGO_HOME="${CARGO_HOME:-$HOME/.cargo-jd}"
mkdir -p "$CARGO_HOME"
cp scripts/cargo-config-jd.toml "$CARGO_HOME/config.toml"
export PATH="$CARGO_HOME/bin:$HOME/.cargo/bin:$PATH"
if ! command -v corepack >/dev/null 2>&1; then
npm install --global corepack

View File

@ -0,0 +1,8 @@
[source.crates-io]
replace-with = "rsproxy-sparse"
[source.rsproxy-sparse]
registry = "sparse+https://rsproxy.cn/index/"
[net]
git-fetch-with-cli = true