Skip to content

Instantly share code, notes, and snippets.

@leodutra
Last active May 16, 2026 20:46
Show Gist options
  • Select an option

  • Save leodutra/ce64b3d6c9335c1e2b587eeb8c80d1d7 to your computer and use it in GitHub Desktop.

Select an option

Save leodutra/ce64b3d6c9335c1e2b587eeb8c80d1d7 to your computer and use it in GitHub Desktop.
Rust Dev Env Install - 2026 - Arch Linux
#!/usr/bin/env bash
set -euo pipefail
# ============================================================
# Rust development environment bootstrap (Arch Linux + zsh)
# ============================================================
# ------------------------------------------------------------
# Helpers
# ------------------------------------------------------------
zshrc_append() {
# Append a line to ~/.zshrc only if it isn't already there.
local line="$1"
grep -qxF "$line" ~/.zshrc 2>/dev/null || echo "$line" >> ~/.zshrc
}
# ------------------------------------------------------------
# System packages (pacman)
# ------------------------------------------------------------
pacman_packages=(
# Base development toolchain
base-devel # GCC, make, binutils, etc.
pkgconf # pkg-config implementation
# GPU / compute
cuda # NVIDIA CUDA toolkit
cudnn # NVIDIA deep neural network library
# Media / encoding
ffmpeg # Audio/video processing
# Networking / VCS
git # Version control
libssh # SSH library (used by some crates)
# Rust
rust
rust-src
rust-analyzer
# Build acceleration
sccache # Compiler cache
mold # Ultra-fast linker
clang # Linker driver (used with mold)
)
sudo pacman -Syu --needed --noconfirm "${pacman_packages[@]}"
# ------------------------------------------------------------
# Environment configuration (~/.zshrc)
# ------------------------------------------------------------
zshrc_append 'export RUSTC_WRAPPER=sccache'
zshrc_append 'export CARGO_BUILD_JOBS=$(nproc)'
zshrc_append 'export RUSTFLAGS="-C link-arg=-fuse-ld=mold"'
# ------------------------------------------------------------
# Cargo ecosystem tools
# ------------------------------------------------------------
cargo_packages=(
# Cache / cleanup
cargo-cache # Inspect & clean Cargo cache
# Dependency management
cargo-edit # cargo add/rm/upgrade
cargo-outdated # Check for newer dependency versions
cargo-deny # Security, license, duplicate checks
cargo-license # License inspection
cargo-udeps # Detect unused dependencies
# Debugging / introspection
cargo-expand # Expand macros
cargo-bloat # Analyze binary size
uuinfo # Debug UUIDs, simpleflakes, snowflakes and others
# Docs / QA
cargo-deadlinks # Detect broken doc links
# Testing / benchmarking
cargo-fuzz # Fuzz testing (libFuzzer)
cargo-criterion # Statistical benchmarking
cargo-llvm-cov # Code coverage via LLVM
# Dev workflow
cargo-watch # Re-run on file changes
)
cargo install -f --locked "${cargo_packages[@]}"
echo
echo "Done. Restart your shell or run: source ~/.zshrc"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment