diff options
author | figsoda <figsoda@pm.me> | 2023-05-25 16:29:01 -0400 |
---|---|---|
committer | figsoda <figsoda@pm.me> | 2023-05-25 16:29:01 -0400 |
commit | 545206f93686934998f2f6e74b8d2380f5e2477d (patch) | |
tree | a63ea412cc07d5ecde058986db21bc8ea476cdb5 /pkgs/build-support/rust | |
parent | 954cc087215d8ae90f77c68b26e5f16df2b45073 (diff) | |
download | nixlib-545206f93686934998f2f6e74b8d2380f5e2477d.tar nixlib-545206f93686934998f2f6e74b8d2380f5e2477d.tar.gz nixlib-545206f93686934998f2f6e74b8d2380f5e2477d.tar.bz2 nixlib-545206f93686934998f2f6e74b8d2380f5e2477d.tar.lz nixlib-545206f93686934998f2f6e74b8d2380f5e2477d.tar.xz nixlib-545206f93686934998f2f6e74b8d2380f5e2477d.tar.zst nixlib-545206f93686934998f2f6e74b8d2380f5e2477d.zip |
fetchCrate: allow overriding `registryDl`
This will allow `rustPlatform.importCargoLock` to use `fetchCrate` directly instead of including its own implementation.
Diffstat (limited to 'pkgs/build-support/rust')
-rw-r--r-- | pkgs/build-support/rust/fetchcrate.nix | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pkgs/build-support/rust/fetchcrate.nix b/pkgs/build-support/rust/fetchcrate.nix index 09f5e7805e16..5a896c39c006 100644 --- a/pkgs/build-support/rust/fetchcrate.nix +++ b/pkgs/build-support/rust/fetchcrate.nix @@ -2,6 +2,9 @@ { crateName ? args.pname , pname ? null + # The `dl` field of the registry's index configuration + # https://doc.rust-lang.org/cargo/reference/registry-index.html#index-configuration +, registryDl ? "https://crates.io/api/v1/crates" , version , unpack ? true , ... @@ -11,7 +14,7 @@ assert pname == null || pname == crateName; (if unpack then fetchzip else fetchurl) ({ name = "${crateName}-${version}.tar.gz"; - url = "https://crates.io/api/v1/crates/${crateName}/${version}/download"; + url = "${registryDl}/${crateName}/${version}/download"; } // lib.optionalAttrs unpack { extension = "tar.gz"; } // removeAttrs args [ "crateName" "pname" "version" "unpack" ]) |