DeterminateSystems/riff

Feature Request: Rust projects could read Rustup rust-toolchain files to inform the calculated devShell

shanesveller opened this issue · 2 comments

Upstream reference: https://rust-lang.github.io/rustup/overrides.html#the-toolchain-file

There's two forms I've seen in the wild, a simple string like stable or 1.64.0 or a TOML file that could optionally indicate what compilation target or components were required, as well as what version. Per upstream the former is considered legacy/deprecated.

From my POV, this would both:

  • ease onboarding for projects that previously/currently assumed Rustup was in use
  • allow projects that support or assume Riff to still indicate to new or Nix-averse contributors what toolchain is being targeted

Known complications:

  • Nixpkgs provides a single rustc toolchain version per commit (as with most software)
  • There is a great deal of personal taste involved in choosing between fenix vs oxalica/rust-overlay, and there is lingering OSS code and prose that recommends Mozilla's overlay to be found without searching very hard.

I myself am not a nightly user but I imagine this support would be attractive to such projects as well.

Alternatives considered:

  • A separate location for this information that is not specific to Rustup, such as in a .riff.toml or another project-local file that Riff consumes, would offer much of the same technical capability for projects that don't want to track Nixpkgs' blessed toolchain, but with fewer of the on-ramp benefits IMO. The lion's share of implementation complexity is probably not in this part of the decision, in any case, but in procuring the correct toolchain binaries once the target version is identified.

I think this should be partially fixed by #171. I say "partially", because we still rely on the user having installed Rust via rustup (or having rustup installed). However, this way we don't need to deal with parsing and using the potentially-complex rust-toolchain.toml file ourselves -- rustup handles that.

Please take a look at that PR and let me know what you think! (There are instructions for how to use it in the PR body, since it's not immediately obvious.)