From e2825fb1b5ea01c320b5ffd3ccd4836864f076bb Mon Sep 17 00:00:00 2001 From: Louis Blin <45168934+lbpdt@users.noreply.github.com> Date: Mon, 20 Mar 2023 14:40:04 -0400 Subject: [PATCH] rustPlatform.importCargoLock: improved semantics for 'extraRegistries' option Clearer API following the recommendation on the pull request that introduced this option a few days ago: https://github.com/NixOS/nixpkgs/pull/221381#discussion_r1141226293 --- pkgs/build-support/rust/import-cargo-lock.nix | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkgs/build-support/rust/import-cargo-lock.nix b/pkgs/build-support/rust/import-cargo-lock.nix index 20006f7410df..ac925752f47c 100644 --- a/pkgs/build-support/rust/import-cargo-lock.nix +++ b/pkgs/build-support/rust/import-cargo-lock.nix @@ -12,6 +12,11 @@ # Additional registries to pull sources from # { "https://" = "https://"; } + # where: + # - "index URL" is the "index" value of the configuration entry for that registry + # https://doc.rust-lang.org/cargo/reference/registries.html#using-an-alternate-registry + # - "download URL" is the "dl" value of its associated index configuration + # https://doc.rust-lang.org/cargo/reference/registry-index.html#index-configuration , extraRegistries ? {} # Hashes for git dependencies. @@ -93,12 +98,12 @@ let ''; fetchurl { name = "crate-${pkg.name}-${pkg.version}.tar.gz"; - url = "${downloadUrl}/v1/crates/${pkg.name}/${pkg.version}/download"; + url = "${downloadUrl}/${pkg.name}/${pkg.version}/download"; sha256 = checksum; }; registries = { - "https://github.com/rust-lang/crates.io-index" = "https://crates.io/api"; + "https://github.com/rust-lang/crates.io-index" = "https://crates.io/api/v1/crates"; } // extraRegistries; # Fetch and unpack a crate.