From 8bd54e647c98f5d5fa92a6ca2aac6691c2d652da Mon Sep 17 00:00:00 2001 From: Ivan Petkov Date: Tue, 12 Mar 2024 09:06:24 -0700 Subject: [PATCH] crateRegistries: use crates.io's CDN to download sources https://blog.rust-lang.org/2024/03/11/crates-io-download-changes.html --- CHANGELOG.md | 5 +++++ docs/API.md | 6 +++--- lib/default.nix | 2 +- lib/urlForCargoPackage.nix | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9929029c..81570415 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## Unreleased +### Changed +* Sources are now fetched [crates.io's + CDN](https://blog.rust-lang.org/2024/03/11/crates-io-download-changes.html), + following cargo's (new) default behavior. + ### Fixed: * `vendorMultipleCargoDeps` correctly lists `registries` as an optional parameter diff --git a/docs/API.md b/docs/API.md index 0cf0b3f6..7e370f63 100644 --- a/docs/API.md +++ b/docs/API.md @@ -47,7 +47,7 @@ See the documentation on each function for more specifics. newLib = craneLib.appendCrateRegistries [ (craneLib.registryFromDownloadUrl { indexUrl = "https://github.com/rust-lang/crates.io-index"; - dl = "https://crates.io/api/v1/crates"; + dl = "https://static.crates.io/crates"; fetchurlExtraArgs = {}; }) @@ -1214,12 +1214,12 @@ crate sources (e.g. by setting `curlOptsList`) ```nix craneLib.registryFromDownloadUrl { - dl = "https://crates.io/api/v1/crates"; + dl = "https://static.crates.io/crates"; indexUrl = "https://github.com/rust-lang/crates.io-index"; } # { # "registry+https://github.com/rust-lang/crates.io-index" = { -# downloadUrl = "https://crates.io/api/v1/crates/{crate}/{version}/download"; +# downloadUrl = "https://static.crates.io/crates/{crate}/{version}/download"; # fetchurlExtraArgs = {}; # }; # } diff --git a/lib/default.nix b/lib/default.nix index 258d0d28..94c7edb5 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -38,7 +38,7 @@ in }; crateRegistries = self.registryFromDownloadUrl { - dl = "https://crates.io/api/v1/crates"; + dl = "https://static.crates.io/crates"; indexUrl = "https://github.com/rust-lang/crates.io-index"; }; diff --git a/lib/urlForCargoPackage.nix b/lib/urlForCargoPackage.nix index f88696b8..31da0166 100644 --- a/lib/urlForCargoPackage.nix +++ b/lib/urlForCargoPackage.nix @@ -27,7 +27,7 @@ let craneLib = crane.lib.''${system}.appendCrateRegistries [ (lib.registryFromDownloadUrl { - dl = "https://crates.io/api/v1/crates"; + dl = "https://static.crates.io/crates"; indexUrl = "https://github.com/rust-lang/crates.io-index"; })