Guix Rustup is your go-to channel for managing Rust binary toolchains in the Guix ecosystem. With simple installation and usage commands, you can effortlessly switch between stable, beta, and nightly versions of Rust. Optimize your development process with tailored channel integration and manage Rust environments like never before.
The Guix Rustup project offers a comprehensive Rust binary toolchain channel specifically designed for the Guix operating system. This channel simplifies the management and installation of various Rust toolchains, ensuring developers have access to the specific versions they require for their projects.
Overview
The Guix Rustup channel allows users to integrate Rust seamlessly into their development environment. To get started, add the following code to your ~/.config/guix/channels.scm
:
(cons*
(channel
(name 'rustup)
(url "https://github.com/declantsien/guix-rustup")
(introduction
(make-channel-introduction
"325d3e2859d482c16da21eb07f2c6ff9c6c72a80"
(openpgp-fingerprint
"F695 F39E C625 E081 33B5 759F 0FC6 8703 75EF E2F5"))))
%default-channels)
After this, run guix pull
to update your channels.
Usage
For Stable Rust Versions
To search for available stable Rust toolchains, execute:
guix search rust-toolchain
For Latest Nightly/Beta Toolchains
Use the following commands to build specific Rust versions:
guix build -e '((@@ (rustup build toolchain) rustup) "stable")'
guix build -e '((@@ (rustup build toolchain) rustup) "beta")'
guix build -e '((@@ (rustup build toolchain) rustup) "nightly")'
Invoking via guix shell with manifest.scm
To set up an environment with rustup
, include the following in your manifest.scm
file:
(use-modules (rustup build toolchain))
;; (packages->manifest (list (rustup "nightly-2024-05-18")))
(packages->manifest (list (rustup)))
Configuring Rustup Toolchain Files
The procedures use rustup-toolchain
and rustup-toolchain.toml
for toolchain specification. You can manually specify the path of the toolchain file with:
(rustup "path/to/rust-toolchain")
Rustup Arguments
You can define custom parameters for rustup:
(define* (rustup #:optional (channel-or-toolchain-file #f)
#:key
(components (list ))
(targets (list ))
(profile 'default))
...)
Integrating with the Cargo Build System
The make-cargo-build-system
function can also utilize the same toolchain specifications:
(package
(name "rust-*")
(build-system (make-cargo-build-system "nightly-2024-01-25"))
...)
Using Rustup Distribution Server Mirrors
To set a specific mirror for the Rustup distribution server, run:
export RUSTUP_DIST_SERVER="https://mirrors.ustc.edu.cn/rust-static"
This project is essential for developers who wish to maintain control over their Rust environments and ensure they use the correct toolchain across various projects.