Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test-pr-selective.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
if [ "${{ inputs.force_all }}" = "true" ]; then
# Test all features
FEATURES='["yay","clone-repo","node","rust-bin","dotnet","dotnet-bin","chaotic-aur"]'
FEATURES='["yay","clone-repo","node","rust","rust-bin","dotnet","dotnet-bin","chaotic-aur"]'
echo "Manual dispatch: Testing all features"
elif [ -n "${{ inputs.features }}" ]; then
# Test specified features
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
- yay
- clone-repo
- node
- rust
- rust-bin
- dotnet
- dotnet-bin
Expand All @@ -41,6 +42,7 @@ jobs:
- yay
- clone-repo
- node
- rust
- rust-bin
- dotnet
- dotnet-bin
Expand Down
38 changes: 34 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,27 @@ Installs Node.js and npm with sudo-free configuration for Arch Linux DevContaine
}
```

### 🦀 [Rust and Cargo (rustup)](src/rust-bin/README.md)
### 🦀 [Rust and Cargo (Pre-compiled)](src/rust/README.md)

Installs Rust programming language, Cargo package manager, and development tools via rustup for Arch Linux.
Installs Rust programming language and Cargo package manager from pre-compiled packages for fast installation (10-60 seconds). Includes clippy, rustfmt, rust-src, and rust-analyzer.

```json
{
"features": {
"ghcr.io/zyrakq/arch-devcontainer-features/rust:2": {
"globalCrates": "cargo-watch,cargo-edit,cargo-audit"
}
}
}
```

**Use this when:** You need stable Rust with fast installation for standard development.

**Note:** clippy and rustfmt are always included and cannot be disabled.

### 🦀 [Rust and Cargo (Rustup)](src/rust-bin/README.md)

Installs Rust programming language, Cargo package manager, and development tools via rustup for Arch Linux. Provides beta/nightly toolchains and additional compilation targets.

```json
{
Expand All @@ -80,6 +98,8 @@ Installs Rust programming language, Cargo package manager, and development tools
}
```

**Use this when:** You need beta/nightly toolchains, multiple toolchain management, or additional compilation targets.

### 🟣 [.NET SDK and Runtime](src/dotnet/README.md)

Installs .NET SDK, runtime, and development tools from official Arch Linux packages.
Expand Down Expand Up @@ -121,9 +141,11 @@ This project uses a Git submodules architecture for stability:
arch-devcontainer-features/
├── src/ # Our features
│ ├── yay/
│ ├── chaotic-aur/
│ ├── clone-repo/
│ ├── node/
│ ├── rust/
│ ├── rust/ # Rust and Cargo feature (pre-compiled)
│ ├── rust-bin/ # Rust and Cargo feature (rustup)
│ ├── dotnet/
│ └── dotnet-bin/
└── vendor/ # Dependencies
Expand Down Expand Up @@ -246,6 +268,12 @@ URL="https://raw.githubusercontent.com/bartventer/arch-devcontainer-features/${C
│ │ ├── devcontainer-feature.json
│ │ ├── install.sh
│ │ └── README.md
│ ├── rust/ # Rust and Cargo feature (pre-compiled)
│ │ ├── devcontainer-feature.json
│ │ ├── install.sh
│ │ ├── NOTES.md
│ │ ├── examples.md
│ │ └── README.md
│ ├── rust-bin/ # Rust and Cargo feature (rustup)
│ │ ├── devcontainer-feature.json
│ │ ├── install.sh
Expand Down Expand Up @@ -304,6 +332,7 @@ Features are automatically published to:
- `ghcr.io/zyrakq/arch-devcontainer-features/chaotic-aur`
- `ghcr.io/zyrakq/arch-devcontainer-features/clone-repo`
- `ghcr.io/zyrakq/arch-devcontainer-features/node`
- `ghcr.io/zyrakq/arch-devcontainer-features/rust`
- `ghcr.io/zyrakq/arch-devcontainer-features/rust-bin`
- `ghcr.io/zyrakq/arch-devcontainer-features/dotnet`
- `ghcr.io/zyrakq/arch-devcontainer-features/dotnet-bin`
Expand All @@ -314,7 +343,8 @@ Features are automatically published to:
- [Chaotic-AUR Repository](src/chaotic-aur/README.md) - Chaotic-AUR feature documentation
- [Clone Repository](src/clone-repo/README.md) - Clone-repo feature documentation
- [Node.js and npm](src/node/README.md) - Node.js feature documentation
- [Rust and Cargo (rustup)](src/rust-bin/README.md) - Rust feature documentation
- [Rust and Cargo (pre-compiled)](src/rust/README.md) - Rust feature documentation (pre-compiled packages)
- [Rust and Cargo (rustup)](src/rust-bin/README.md) - Rust feature documentation (rustup)
- [.NET SDK and Runtime](src/dotnet/README.md) - .NET feature documentation (official packages)
- [.NET SDK and Runtime (AUR)](src/dotnet-bin/README.md) - .NET feature documentation (AUR packages)
- [DevContainers Specification](https://containers.dev/implementors/features/) - Official specification
Expand Down
228 changes: 228 additions & 0 deletions src/rust/NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
# 🦀 Rust (Pre-compiled)

## 📝 Description

This feature installs Rust programming language and Cargo package manager from **pre-compiled packages** in the official Arch Linux repositories. This provides a fast installation (10-60 seconds) with the stable Rust toolchain.

## 🤔 When to Use This Feature

Use the **`rust`** feature (this one) when you need:

- ✅ **Fast installation** - Pre-compiled binaries install in 10-60 seconds
- ✅ **Stable Rust** - Production-ready stable toolchain
- ✅ **Standard development** - Most Rust projects work with stable
- ✅ **IDE integration** - Includes rust-analyzer and rust-src
- ✅ **CI/CD environments** - Where build time matters

Use **`rust-bin`** instead when you need:

- 🔧 Beta or Nightly toolchains
- 🔧 Multiple toolchain management via rustup
- 🔧 Additional compilation targets (wasm, windows, etc.)
- 🔧 Specific Rust versions

## 🚀 Quick Start

### Basic Installation (Recommended)

```json
{
"features": {
"ghcr.io/zyrakq/arch-devcontainer-features/rust:2": {}
}
}
```

This installs Rust stable with **clippy**, **rustfmt** (always included), **rust-src**, and **rust-analyzer**.

### Minimal Installation

```json
{
"features": {
"ghcr.io/zyrakq/arch-devcontainer-features/rust:2": {
"installRustSrc": false,
"installRustAnalyzer": false
}
}
}
```

Minimal setup includes rustc, cargo, clippy, and rustfmt only (without IDE components).

### With Global Crates

```json
{
"features": {
"ghcr.io/zyrakq/arch-devcontainer-features/rust:2": {
"globalCrates": "cargo-watch,cargo-edit,cargo-audit"
}
}
}
```

## ⚙️ Configuration Options

| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `installRustSrc` | boolean | `true` | Install Rust source code (for IDE support) |
| `installRustAnalyzer` | boolean | `true` | Install rust-analyzer LSP server |
| `globalCrates` | string | `""` | Comma-separated list of crates to install globally |

**Note:** `clippy` and `rustfmt` are always installed as part of the `rust` package and cannot be disabled.

### 🎯 Popular Global Crates

- **`cargo-watch`** - Automatically re-run cargo commands on file changes
- **`cargo-edit`** - Add, remove, and upgrade dependencies
- **`cargo-audit`** - Security vulnerability scanner
- **`cargo-expand`** - Show macro-expanded code
- **`cross`** - Zero-setup cross compilation

## 🏗️ Architecture

### 📦 Installation Method

1. **pacman packages** - Install from official Arch repositories
- `rust` - Rust compiler, cargo, clippy, and rustfmt (all-in-one package)
- `rust-src` - Rust source code (optional, for IDE support)
- `rust-analyzer` - LSP server (optional, for IDE integration)

2. **cargo install** - Install additional tools via cargo

### ⚡ Performance

- **Installation time**: 10-60 seconds (vs 10-60+ minutes with rustup)
- **Download size**: ~200MB pre-compiled binaries
- **Disk usage**: ~1-1.5GB (vs ~2GB with rustup)

### 🔧 Limitations

- Only **stable** Rust version available
- No built-in support for **additional targets**
- Use `cross` crate for cross-compilation
- Or install `rust-bin` feature alongside for rustup targets
- No **beta/nightly** toolchains
- Version controlled by Arch repositories (usually 1-2 weeks behind latest stable)

## 🔄 Cross-Compilation

For cross-compilation, use the `cross` crate:

```bash
cargo install cross
cross build --target aarch64-unknown-linux-gnu
```

Alternatively, use the `rust-bin` feature for more flexibility with additional targets:

```json
{
"features": {
"ghcr.io/zyrakq/arch-devcontainer-features/rust-bin:1": {
"rustVersion": "stable",
"installClippy": true,
"installRustfmt": true,
"additionalTargets": "wasm32-unknown-unknown,aarch64-unknown-linux-gnu"
}
}
}
```

The `rust-bin` feature provides rustup-based installation with support for multiple targets and toolchains.

## ✅ Compatibility

### 🐧 System Requirements

- **OS**: Arch Linux
- **Architecture**: x86_64, aarch64
- **Dependencies**: None (base-devel recommended for some crates)

### 🔗 DevContainer Integration

- Works with any DevContainer base image running Arch Linux
- Compatible with VS Code DevContainers
- Supports multi-stage builds and feature composition

## 🧪 Testing

### 📋 Test Scenarios

- **Basic installation** - Default stable Rust setup
- **Minimal installation** - Without IDE components
- **Global crates** - User-specified crate installation
- **Full setup** - All components enabled

### 🔍 Verification Steps

1. Rust compiler availability (`rustc --version`)
2. Cargo package manager (`cargo --version`)
3. Component availability (clippy, rustfmt, rust-analyzer)
4. Cargo tools functionality
5. Environment variable configuration

## 🚨 Troubleshooting

### 🔧 Common Issues

**Rust version is not the latest:**

- Arch repositories update weekly, usually 1-2 weeks behind
- For absolute latest, use `rust-bin` feature with rustup

**Need beta/nightly Rust:**

- Use `rust-bin` feature which provides rustup
- This feature only provides stable from pacman

**Cross-compilation targets missing:**

- Use `cross` crate: `cargo install cross`
- Or use `rust-bin` feature which provides rustup with target management

**Cargo tools not found in PATH:**

- Verify that `~/.cargo/bin` is in PATH
- Source shell profile or restart terminal

### 🔍 Debug Commands

```bash
# Check Rust installation
rustc --version
cargo --version

# Check components
cargo clippy --version
rustfmt --version
rust-analyzer --version

# Check cargo tools
ls ~/.cargo/bin/

# Verify environment
echo $PATH | grep cargo
```

## 📚 Additional Resources

- **📖 Official Documentation**: [Rust Book](https://doc.rust-lang.org/book/)
- **🛠️ Cargo Guide**: [Cargo Book](https://doc.rust-lang.org/cargo/)
- **🦀 Community**: [Rust Users Forum](https://users.rust-lang.org/)
- **📦 Arch Package**: [rust](https://archlinux.org/packages/extra/x86_64/rust/)

## 🔄 Maintenance

### 📅 Regular Updates

- Monitor Rust release schedule
- Arch packages typically updated within 1-2 weeks of stable release
- Update global crate versions as needed

### 🧪 Testing Updates

- Test with new Rust versions before updating defaults
- Verify compatibility with latest DevContainer specifications
- Validate package availability in Arch repositories
26 changes: 26 additions & 0 deletions src/rust/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"id": "rust",
"version": "2.0.0",
"name": "Rust and Cargo",
"description": "Installs Rust, Cargo, and development tools from pre-compiled packages for fast installation on Arch Linux",
"installsAfter": [
"ghcr.io/bartventer/arch-devcontainer-features/common-utils"
],
"options": {
"installRustSrc": {
"type": "boolean",
"default": true,
"description": "Install Rust source code (for IDE support and rust-analyzer)"
},
"installRustAnalyzer": {
"type": "boolean",
"default": true,
"description": "Install rust-analyzer LSP server (for IDE integration)"
},
"globalCrates": {
"type": "string",
"default": "",
"description": "Comma-separated list of crates to install globally via cargo install"
}
}
}
Loading
Loading