fetch-cargo-deps: factor into fetchCargoDeps function
This commit is contained in:
parent
34023d867d
commit
4f74a4aacb
@ -1,7 +1,4 @@
|
||||
source $stdenv/setup
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
fetchCargoDeps() {
|
||||
src=$(realpath $1)
|
||||
out=$(realpath $2)
|
||||
|
||||
@ -34,11 +31,9 @@ fi
|
||||
|
||||
# We need to do the following string replacement so that 'cargo fetch'
|
||||
# doesn't ignore the versions specified in Cargo.lock
|
||||
set +u
|
||||
substituteInPlace Cargo.lock \
|
||||
--replace "registry+https://github.com/rust-lang/crates.io-index" \
|
||||
"registry+file://$rustRegistry"
|
||||
set -u
|
||||
|
||||
# Do any possible 'cargo update -p <pkgName> --precise <version>' ad-hoc updates
|
||||
eval "$cargoUpdateHook"
|
||||
@ -97,11 +92,9 @@ rm $out/config
|
||||
# We need to replace the rustRegistry URL with something deterministic.
|
||||
# Since the URL won't actually be accessed anymore, it's fine to use /dev/null.
|
||||
|
||||
set +u
|
||||
substituteInPlace Cargo.lock \
|
||||
--replace "registry+file://$rustRegistry" \
|
||||
"registry+file:///dev/null"
|
||||
set -u
|
||||
mv Cargo.lock $out/
|
||||
|
||||
|
||||
@ -181,3 +174,4 @@ done)
|
||||
# sporadic hash mismatches
|
||||
find $out ! -type f
|
||||
find $out -type f -exec sha256sum {} +
|
||||
}
|
||||
|
@ -9,8 +9,11 @@ stdenv.mkDerivation {
|
||||
phases = "unpackPhase installPhase";
|
||||
|
||||
installPhase = ''
|
||||
source ${./fetch-cargo-deps}
|
||||
|
||||
export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
|
||||
bash ${./fetch-cargo-deps} . "$out"
|
||||
|
||||
fetchCargoDeps . "$out"
|
||||
'';
|
||||
|
||||
outputHashAlgo = "sha256";
|
||||
|
Loading…
x
Reference in New Issue
Block a user