fetch-cargo-tarball: allow use index mirror
This commit is contained in:
parent
8508d5decf
commit
656e3022f4
1 changed files with 11 additions and 2 deletions
|
@ -58,9 +58,18 @@ in stdenv.mkDerivation ({
|
|||
export CARGO_HOME=$(mktemp -d cargo-home.XXX)
|
||||
CARGO_CONFIG=$(mktemp cargo-config.XXXX)
|
||||
|
||||
if [[ -n "$NIX_CRATES_INDEX" ]]; then
|
||||
cat >$CARGO_HOME/config.toml <<EOF
|
||||
[source.crates-io]
|
||||
replace-with = 'mirror'
|
||||
[source.mirror]
|
||||
registry = "$NIX_CRATES_INDEX"
|
||||
EOF
|
||||
fi
|
||||
|
||||
${cargoUpdateHook}
|
||||
|
||||
cargo vendor $name | cargo-vendor-normalise > $CARGO_CONFIG
|
||||
cargo vendor $name --respect-source-config | cargo-vendor-normalise > $CARGO_CONFIG
|
||||
|
||||
# Add the Cargo.lock to allow hash invalidation
|
||||
cp Cargo.lock.orig $name/Cargo.lock
|
||||
|
@ -81,7 +90,7 @@ in stdenv.mkDerivation ({
|
|||
|
||||
inherit (hash_) outputHashAlgo outputHash;
|
||||
|
||||
impureEnvVars = lib.fetchers.proxyImpureEnvVars;
|
||||
impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ [ "NIX_CRATES_INDEX" ];
|
||||
} // (builtins.removeAttrs args [
|
||||
"name" "sha256" "cargoUpdateHook" "nativeBuildInputs"
|
||||
]))
|
||||
|
|
Loading…
Reference in a new issue