build(nix): fix downloads from crates.io in nix builds#8282
Merged
Conversation
b7fa826 to
872e960
Compare
adbenitez
approved these changes
May 29, 2026
872e960 to
399a245
Compare
399a245 to
81d1b9f
Compare
crates.io recently started rejecting requests to https://crates.io/api/v1/crates made by Nix: rust-lang/crates.io#13482 This resulted in failing to download any dependencies from crates.io with 403 error during Rust package builds. The problem was solved in nixpkgs by switching to CDN URL https://static.crates.io/crates in NixOS/nixpkgs#524985 As of writing this on 2026-05-29 the fix is on "master" branch of nixpkgs, but not on "nixos-unstable" or "nixpkgs-unstable" branches yet according to https://nixpk.gs/pr-tracker.html?pr=524985 so I have switched nixpkgs to "master" branch to get the problem fixed. naersk needs a similar fix. I opened a PR for it nix-community/naersk#391 but because the fix is not merged yet, switched to my PR branch in flake.nix. Updating nixpkgs required some minor changes, e.g. sphinx_rtd_theme has been renamed to sphinx-rtd-theme, pthreads in Windows builds had to be moved to buildInputs to fix "Refusing to evaluate package 'mingw_w64-pthreads-13.0.0' in /nix/store/f78lkqnk63pd0kf52zf2wcx35p1nnalr-source/pkgs/os-specific/windows/mingw-w64/headers.nix:35 because it is not available on the requested hostPlatform"
81d1b9f to
eae6650
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
crates.io recently started rejecting calls to https://crates.io/api/v1/crates
made by Nix, apparently based on the user agent.
This resulted in failing to download any dependencies
from crates.io with 403 error during Rust package builds.
The problem was solved in nixpkgs by switching
to CDN URL https://static.crates.io/crates
in NixOS/nixpkgs#524985
As of writing this on 2026-05-29
the fix is on "master" branch of nixpkgs,
but not on "nixos-unstable" or "nixpkgs-unstable"
branches yet according to https://nixpk.gs/pr-tracker.html?pr=524985
so I have switched nixpkgs to "master" branch to get the problem fixed.
naersk needs a similar fix. I opened a PR for it
nix-community/naersk#391
but because the fix is not merged yet,
switched to my PR branch in flake.nix.
Updating nixpkgs required some minor changes,
e.g. sphinx_rtd_theme has been renamed to sphinx-rtd-theme,
pthreads in Windows builds had to be moved to buildInputs to fix
"Refusing to evaluate package 'mingw_w64-pthreads-13.0.0'
in /nix/store/f78lkqnk63pd0kf52zf2wcx35p1nnalr-source/pkgs/os-specific/windows/mingw-w64/headers.nix:35
because it is not available on the requested hostPlatform"