Skip to content

fetchurl: don't prefer hashed mirrors by default #405149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 9, 2025

Conversation

winterqt
Copy link
Member

@winterqt winterqt commented May 8, 2025

Right now, when building any FOD that uses fetchurl (which is the majority of ours), tarballs.nixos.org will always be contacted before the actual URL. Given that tarballs.nixos.org mainly hosts the bootstrap tools, which already explicitly set it as the host to pull from, it doesn't make much sense to force every other fetchurl invocation to first reach out to tarballs.nixos.org.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

Right now, when building any FOD that uses `fetchurl` (which is the
majority of ours), `tarballs.nixos.org` will always be contacted
before the actual URL. Given that `tarballs.nixos.org` mainly hosts
the bootstrap tools, which already explicitly set it as the host to pull
from, it doesn't make much sense to force every other `fetchurl`
invocation to first reach out to `tarballs.nixos.org`.
@github-actions github-actions bot added the 6.topic: fetch Fetchers (e.g. fetchgit, fetchsvn, ...) label May 8, 2025
@nix-owners nix-owners bot requested a review from philiptaron May 8, 2025 07:34
@github-actions github-actions bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels May 8, 2025
@winterqt
Copy link
Member Author

winterqt commented May 8, 2025

@ofborg build tests.fetchurl

@philiptaron
Copy link
Contributor

Is there a report or logs from the infra team we could use to track the positive impact on t.n.o of this PR?

@winterqt
Copy link
Member Author

winterqt commented May 8, 2025

I doubt it (nor do I really think it’d be worth the time/effort to pull), but cc @mweinelt

@wegank wegank added 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. labels May 8, 2025
@mweinelt
Copy link
Member

mweinelt commented May 8, 2025

We have some data that we used to grab from fastly, who handle the reverse proxying and caching for us.

Currently fetching that data is in limbo. We need to finish NixOS/infra#388 on the infra side to make this data available again.

@wegank wegank added 12.approvals: 2 This PR was reviewed and approved by two persons. and removed 12.approvals: 1 This PR was reviewed and approved by one person. labels May 8, 2025
@winterqt
Copy link
Member Author

winterqt commented May 8, 2025

Objections to backporting? TBH I wouldn’t consider this a breaking change, as it’ll still fetch from t.n.o if it can’t reach the specified host (and if anything was relying on this behavior by putting a bogus/incorrect URL in, that’s a bug).

@winterqt
Copy link
Member Author

winterqt commented May 9, 2025

Going to land now, but would appreciate some opinions on backporting. (@mweinelt said yes to me on Matrix, at least.)

@winterqt winterqt merged commit 1945203 into NixOS:master May 9, 2025
37 checks passed
@winterqt winterqt deleted the push-olnwpkyrvzlk branch May 9, 2025 03:51
@nixpkgs-ci
Copy link
Contributor

nixpkgs-ci bot commented May 10, 2025

Successfully created backport PR for release-24.11:

@nixpkgs-ci nixpkgs-ci bot added the 8.has: port to stable This PR already has a backport to the stable release. label May 10, 2025
@elpdt852
Copy link
Contributor

elpdt852 commented Jun 16, 2025

@winterqt We hit this change internally and just wanted to share a data point. For some context, we host our internal Nix cache so we don't benefit from cache.nixos.org narinfo-style substitution.

Sometimes the contents of the URL changes in a way (say GitHub changes .patch formatting) that causes a hash mismatch, but a point-in-time copy is available in tarballs.nixos.org which actually hosts a significant amount of the FODs. I believe nix-infra or somewhere crawls FODs using the find-tarballs.nix and uploads them there.

After this change, we're left with either modifying the FOD hash or maintaining a patch reverting this change. In a way this was a breaking change for us, but I understand we may be a bespoke usecase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: fetch Fetchers (e.g. fetchgit, fetchsvn, ...) 8.has: port to stable This PR already has a backport to the stable release. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 12.approvals: 2 This PR was reviewed and approved by two persons. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants