I’ve been experimenting with a setup that could make distro rust and rustup peacefully coexist, but leave full configurability to the user, up to and including running their own rustup installation. It involves installing another set of proxy executables in the system path and moving rust and rustup out of the way, but so that the proxies know about them. In more detail:
-
The system rust is in /usr/lib/rust, exactly as it would’ve been installed by rustup (it has bin/, lib/ etc.) This could be further subdivided with separate named versions and placed under control of an alternatives scheme, I didn’t try to go that far;
-
The system rustup executables are in /usr/lib/rustup or /usr/libexec/rustup, whatever the distro convention is;
-
The proxies are in /usr/bin. A Bourne shell prototype of a proxy is available. The same script can be used as rustup, rustc, cargo, and rustdoc by naming it correspondingly. (I haven’t tested debugger invocation.)
The proxies would be in a separate package, and the system rust and rustup packages would depend on it. A proxy checks if there is a valid rustup toolchain directory in $HOME/.multirust or $RUSTUP_HOME. If there is, and the system rustup is installed, the appropriate rustup proxy is invoked (modulo setting USE_SYSTEM_RUST, which requests the use of distro rust.) To use rustup after installing it, the user must first run rustup init, which links the system rust as the toolchain named system and sets it as default.
Note that this a) doesn’t require the modification of $PATH, b) always results in a working configuration, even between installing rustup and initializing it. The need for a separate initialization step is a bit unfortunate, but IMO tolerable.
It’s true that rustup and the distro package manager are a kind of competition, but with the Rust development model in mind, I don’t think it would be realistic to expect a distribution to package all artifacts available to a developer. Rustup fills that niche (and then some!), and I’m reasonably convinced that it can be made to play nicely with what the distro provides.