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