|Shared Rust installation for Toolforge|
|Description||Maintains a shared rustup toolchain for other tools to use|
|Author(s)||The Rust Project|
|Maintainer(s)||Legoktm, APerson, Magnus Manske, Erutuon (View all)|
|License||Apache License 2.0|
- Main article: Help:Toolforge/Rust
This tool maintains and manages a shared rustup installation for use on Toolforge. To use it in your tool, add the following to
. "/data/project/rustup/rustup/.cargo/env" export RUSTUP_HOME=/data/project/rustup/rustup/.rustup
After logging out and in again, try running
rustup show, you should see something like:
Default host: x86_64-unknown-linux-gnu rustup home: /data/project/rustup/rustup/.rustup installed toolchains -------------------- stable-x86_64-unknown-linux-gnu (default) 1.55-x86_64-unknown-linux-gnu 1.56-x86_64-unknown-linux-gnu active toolchain ---------------- stable-x86_64-unknown-linux-gnu (default) rustc 1.56.1 (59eed8a2a 2021-11-01)
If you had previously installed rustup in the tool itself, you should make sure to uninstall it first, usually
rustup self uninstall will do the trick.
Using a different Rust version
By default, you will follow the "stable" channel, which will track the latest stable Rust version within a day of its release. If you want to track a specific minor Rust version, like 1.55, you can either specify the version in each command you run, e.g.
cargo +1.55 build --release or you can create a
rust-toolchain.toml in your project.
All stable Rust versions since 1.55 should be available. If you need something older, please ask one of the maintainers to install it for you.
If you try setting a
rustup override or using
rustup default, it will not work because of how the shared installation is set up. Sorry.
Extra Rust utilities
For convenience we also install the latest version (within a day of their releases) of some utilities that are written in Rust:
The same setup instructions will make these utilities available in your
$PATH. If you would like something else installed, please ask one of the maintainers to add it for you.
The installation was set up by creating a new directory in /data/project/rustup, chmod -R 755ing it so only that tool can modify it, then running:
export RUSTUP_HOME=/data/project/rustup/rustup/.rustup export CARGO_HOME=/data/project/rustup/rustup/.cargo curl https://sh.rustup.rs -sSf | sh -s -- --profile minimal
The update script runs on a daily cron:
#!/bin/bash # SPDX-License-Identifier: Apache-2.0 # Copyright (C) 2021 Kunal Mehta set -euxo pipefail # Update existing toolchains rustup update # Add the latest minor Rust toolchain export LATEST_RUST=$(curl 'https://release-monitoring.org/api/v2/versions/?project_id=7635' | jq '.latest_version' -r | cut -c -4) rustup toolchain install $LATEST_RUST # https://github.com/rust-lang/cargo/issues/4350#issuecomment-340215811 export TMPDIR=/data/project/rustup/tmp # Install popular tools cargo install ripgrep cargo install fd-find
--- - name: update command: ./update.sh image: tf-python39 schedule: "1 2 * * * " emails: onfailure mem: 2G