What Are Build Backends?
Build backends are executables that:- Follow a specific protocol for communication with Pixi
- Handle language-specific build logic
- Convert projects into conda packages
- Are decoupled from Pixi’s manifest specification
Available Backends
pixi-build-cmake
For CMake-based C/C++ projects. Automatically provides CMake, Ninja, and compilers.
pixi-build-python
For Python packages using PEP 517 build backends like Hatchling or setuptools.
pixi-build-rattler-build
For direct recipe.yaml builds with full control over the build process.
pixi-build-ros
For ROS (Robot Operating System) packages using colcon.
pixi-build-rust
For Cargo-based Rust applications and libraries.
pixi-build-mojo
For Mojo applications and packages.
All backends are available through conda-forge and work across Linux, macOS, and Windows.
Quick Comparison
| Backend | Use Case | Auto-installed Tools | Configuration |
|---|---|---|---|
| cmake | C/C++ projects | CMake, Ninja, compilers | CMakeLists.txt |
| python | Python packages | None | pyproject.toml + pixi.toml |
| rattler-build | Custom recipes | None | recipe.yaml |
| ros | ROS packages | colcon, rosdep | package.xml |
| rust | Rust projects | Rust toolchain | Cargo.toml |
| mojo | Mojo projects | Mojo toolchain | magic.toml |
Installing a Backend
Specify the backend in your manifest:pixi.toml
Using Custom Backend Channels
For the latest features, use the dedicated backend channel:pixi.toml
The
pixi-build-backends channel contains pre-release versions with the latest features.Common Backend Configurations
Backend-Specific Configuration
Each backend supports custom configuration through[package.build.config]:
CMake Backend
Python Backend
Rust Backend
Overriding Build Backends
For development, you can override backends:Override Specific Backends
{name}={path} with multiple backends separated by commas.
pixi-build-cmake=/path/to/bin- Use local executablepixi-build-python- Use version from PATH
Override All Backends
Debugging Builds
Inspecting Generated Recipes
Backends generate rattler-build recipes stored in your project:Rebuilding with rattler-build
Rerun a build directly:- Inspect exact build recipes
- Debug build failures
- Understand backend behavior
- Compare variant configurations
The
<variant_hash> ensures each unique combination of build variants gets its own recipe directory.Examining JSON-RPC Communication
Find debug files in the recipe directory:Backend Development
Backends implement a protocol for:- Manifest protocol - Understanding project configuration
- Build protocol - Executing builds
- Recipe generation - Creating rattler-build recipes
Creating a Custom Backend
Backends must:- Accept JSON-RPC requests on stdin
- Return JSON-RPC responses on stdout
- Implement required protocol methods
- Generate valid rattler-build recipes
Backend Selection Guide
# Python: specify PEP 517 backend
[package.host-dependencies]
hatchling = "*"
# C++: usually none (cmake backend provides tools)
[package.host-dependencies]
# Empty or specific libraries
# Rust: may need system dependencies
[package.host-dependencies]
openssl = "*"
Advanced Topics
Key Concepts
Compilers
How pixi-build integrates with conda-forge’s compiler infrastructure for cross-platform builds.
Multiple Backends in a Workspace
Different packages can use different backends:Backend Versioning
Pin backends for reproducible builds:Real-World Examples
Mixed Python and C++
pixi.toml
packages/cpp_core/pixi.toml
Best Practices
Pin backend versions
Pin backend versions
Use specific version ranges for reproducible builds:
Use appropriate backend for language
Use appropriate backend for language
Don’t force a backend:
Keep backend config minimal
Keep backend config minimal
Let backends handle defaults:
Document backend choices
Document backend choices
Comment why you chose a backend:
Next Steps
pixi-build-cmake
Complete CMake backend documentation
pixi-build-python
Complete Python backend documentation
Dependency Types
How backends use different dependencies
Build Variants
Building multiple configurations
Troubleshooting
Backend not found
Backend not found
Ensure backend channel is included:
Build fails with backend error
Build fails with backend error
Check generated recipe:Try rebuilding with rattler-build directly for better error messages.
Backend version conflicts
Backend version conflicts
Explicitly specify compatible versions:
Different backend needed
Different backend needed
Some backends may not support all features. Consider:
- Switching to
pixi-build-rattler-buildfor full control - Contributing to the backend repository
- Opening an issue for missing features