Skip to content

build(nix): fix downloads from crates.io in nix builds#8282

Merged
link2xt merged 1 commit into
mainfrom
link2xt/fix-nix-build
May 29, 2026
Merged

build(nix): fix downloads from crates.io in nix builds#8282
link2xt merged 1 commit into
mainfrom
link2xt/fix-nix-build

Conversation

@link2xt
Copy link
Copy Markdown
Collaborator

@link2xt link2xt commented May 28, 2026

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"

@link2xt link2xt force-pushed the link2xt/fix-nix-build branch from 872e960 to 399a245 Compare May 29, 2026 07:49
@link2xt link2xt changed the title Fix nix build build(nix): fix nix builds after crates.io update May 29, 2026
@link2xt link2xt force-pushed the link2xt/fix-nix-build branch from 399a245 to 81d1b9f Compare May 29, 2026 08:01
@link2xt link2xt changed the title build(nix): fix nix builds after crates.io update build(nix): fix downloads from crates.io in nix builds May 29, 2026
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"
@link2xt link2xt force-pushed the link2xt/fix-nix-build branch from 81d1b9f to eae6650 Compare May 29, 2026 08:05
@link2xt link2xt merged commit 0bc7849 into main May 29, 2026
95 of 96 checks passed
@link2xt link2xt deleted the link2xt/fix-nix-build branch May 29, 2026 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants