Skip to content

Allow overriding the dist server - #124

Open
roblabla wants to merge 6 commits into
nix-community:stagingfrom
roblabla:override-dist-server
Open

Allow overriding the dist server#124
roblabla wants to merge 6 commits into
nix-community:stagingfrom
roblabla:override-dist-server

Conversation

@roblabla

@roblabla roblabla commented Nov 21, 2023

Copy link
Copy Markdown

The goal of this PR is to make it possible to use a mirror of rustup, such as one created using Panamax, with fenix.

To do so, it fixes three issues:

  • When setting a custom dist server, if the manifest contains links to the default dist server, rustup will automatically replace it with an URL pointing to the custom dist server. This allows making very naive mirrors of the rustup dist server without having to modify the channel manifests.
    Currently, fenix allows setting a custom dist server through toolchainOf, but it does not replicate this behavior of overriding the URL in the manifests. This PR adds this behavior.

  • Furthermore, it adds a root argument to fromToolchainFile, allowing the simultaneous use of a toolchain file and a custom dist server.

  • Finally, it replaces the archive it gets from the gz ones to xz ones. Rust started providing xz archives in may 2017, and rustup switched to grabbing the xz archives not long after. Panamax, the most popular tool to mirror rustup, defaults to only grabbing the xz archives.

@roblabla

roblabla commented Feb 8, 2024

Copy link
Copy Markdown
Author

Bump?

@roblabla

Copy link
Copy Markdown
Author

Bump? Is this project dead?

@eureka-cpu eureka-cpu added the enhancement New feature or request label Sep 27, 2025

@eureka-cpu eureka-cpu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one @roblabla. This looks great, and doesn't change the default behavior. Would you mind updating the README with this use case as well?

@eureka-cpu

Copy link
Copy Markdown
Member

Also please target staging.

@roblabla
roblabla changed the base branch from main to staging September 27, 2025 21:44
@roblabla

Copy link
Copy Markdown
Author

I added a quick documentation line for the new root parameter in the README. I can provide a full-blown usage example for the use-case if necessary - adding it under the # Examples heading?

@eureka-cpu

Copy link
Copy Markdown
Member

I added a quick documentation line for the new root parameter in the README. I can provide a full-blown usage example for the use-case if necessary - adding it under the # Examples heading?

Thanks, that would be great 🙂

@roblabla
roblabla force-pushed the override-dist-server branch from db7bdc0 to c97c392 Compare September 28, 2025 15:19
@eureka-cpu

Copy link
Copy Markdown
Member

@roblabla is this ready? if not just request my review again when you are 🙂

@roblabla

Copy link
Copy Markdown
Author

CI is failing, need to look into it. I think it's broken because the hardcoded toolchain URLs in data only lists the url/hash, and not the xz_url/xz_hash.

I'll need to either

  1. make a script that swaps it from the former to the latter (and update whatever script is responsible for updating it to grab the xz)
  2. Make the code fallback to using the gz if xz is absent.

@roblabla
roblabla force-pushed the override-dist-server branch from 811a1dd to 2a36bd1 Compare September 29, 2025 12:10
@eureka-cpu

Copy link
Copy Markdown
Member

Nice one. Probably we will want to test it in CI with something small, so we aren't trying to build an entirely separate toolchain which isn't cached with the substituter. I think this way we can also be sure if it's actually using the xz_url.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants