rust-lang / rust-lang/rustup

Provide post-unpack and/or post-download hooks

Open
#673 7 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
7k
Forks
1.1k
Avg merge
22h 40m
Merged PRs (30d)
46

Description

Sorry for the long introduction, I'll try to keep it short:

I'm maintaining rust packages for NixOS, a linux distribution with an unique (purely functional) approach to packaging. Packages are reproducible, isolated, and immutable. One thing we do for this is to patch our binaries to use absolute paths for dynamically loaded libraries while not having a "classic" /lib or /usr/lib directory.

This also means that it's unfortunately not possible to run "normal" binaries (without absolute paths to dependencies or /lib/ld-linux.so) without patching them first. This also means that it's impossible to use the toolchains downloaded by rustup.rs as-is without patching them first.

I want to suggest adding an option to rustup.rs that will run a hook (any shell script or executable) right after switching (or downloading, doesn't really matter) of the toolchain. This would allow us to patch the toolchains and make rustup.rs usable on NixOS.

The great benefit of rustup.rs compared to rustc and cargo in NixOS itself is that it makes it very easy to use recent nightly and beta builds. Right now these lack behind and they will get built from source as there isn't a binary substitution available from our build server (there is one for rustc-stable & cargo-stable).

Is there a chance for such a feature to make it into rustup.rs? If someone can give me some pointers on where to start I'd be happy to take this on myself.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Trace rustup.rs's toolchain downloading and switching flows to identify where a post-download or post-switch hook could run. Clarify the hook timing, configuration, arguments, and failure behavior, then verify that the selected hook can patch downloaded toolchains for NixOS. Done means the agreed hook behavior is implemented and covered by relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.