Prompted by Maturing installation options but wanting to discuss this thing separately, I’m beta testing a new way of installing Rust on Windows.
What’s the current situation
Rust distributes its packages in basically three ways: raw tarballs (which rustup uses), an MSI (which I assume is derived from the raw tarballs), and rustup itself.
The current Chocolatey packages are based on the MSI. Packages plural: one of them is for the MSVC toolchain, while the other is for the MinGW toolchain. I’m not actually planning to change that part, though. You can try these packages just by running
choco install rust or
choco install rust-ms. This is what I inherited from the previous maintainer, who apparently switched off of Windows entirely and stopped maintaining them.
There are two big problems caused by using the MSI:
Portable and user-local installs, which are some of the coolest parts of Chocolatey, are impossible for MSIs.
- Portable installs are the best way to have Chocolatey manage multiple versions of the same application.
- Upgrades don’t work right. Chocolatey assumes that newer MSI installers will perform in-place upgrades of the older ones (this is what Firefox’s installer does, for example). Rust’s don’t, so you wind up with multiple installations of Rust on your system, and no easy way to distinguish between them.
What’s the difference with the new packages
The new pre-release packages, that you can find on my GitHub page, are built from the combined https://static.rust-lang.org/dist/2019-02-28/rust-1.33.0-x86_64-pc-windows-msvc.tar.gz tarball directly. As such, extra components like clippy are included by default, where they weren’t before.
More importantly, though, Chocolatey now keeps track of all of the package’s files, the same way a
.deb or a
.rpm would. And it’s way better. The packages are now portable.
choco up now actually upgrades the packages. And, to top it all off, the installation takes about the same amount of time in spite of technically installing more stuff.
To try them out,
- Install Chocolatey if you don’t already have it
- Check out my GitHub repo. https://github.com/notriddle/notriddle-chocolatey-packages/
- Go into the
choco install -s . (rust|rust-ms)
- Try building Rust projects
What’s in the repo?
- rust and rust-ms are actually generated by the script in _update.
- the two ps1 scripts at the top (update.ps1 and push.ps1) are scripts to help make maintenance easier.
- the script in _update/update.py is what generates the rust and rust-ms package metadata. It’s written in python, because python has a good toml parser that can be installed using pip, unlike the DLL that I would need to install if I wanted to parse toml from powershell (I probably could have done what I wanted with a visual studio project, but don’t even know C#, and it’s not like I’m requiring the end-users to install Python).