Default Behavior
By default, build backends look for source code in the directory containing the package manifest:pixi-build-cmakelooks forCMakeLists.txtin the package directorypixi-build-pythonlooks forpyproject.tomlorsetup.pyin the package directorypixi-build-rustlooks forCargo.tomlin the package directory
The exception is
pixi-build-rattler-build, where you specify the source directly in recipe.yaml.Using a Custom Path
If your source is in a different location, usepackage.build.source.path:
Subdirectory
pixi.toml
Relative Path
Source can be outside the package directory:packages/my_package/pixi.toml
Relative paths are resolved from the package manifest location.
Git Submodules
This works great with git submodules:pixi.toml
Using Git Repositories
Build directly from git repositories:Basic Git Source
pixi.toml
Pinning to a Branch
pixi.toml
Pinning to a Tag
pixi.toml
Pinning to a Commit
pixi.toml
Git Subdirectory
If the package is in a subdirectory of the repository:pixi.toml
Complete Examples
SDL Example from Git
pixi.toml
Python Package with Custom Path
pixi.toml
Multiple Packages from Different Sources
pixi.toml
- Local package in root directory
- Vendored third-party library
- Upstream package with custom source configuration
packages/upstream/pixi.toml
Source Configuration Patterns
Use Cases
Depending on unreleased changes
Depending on unreleased changes
Use a git branch to depend on development versions:Useful for:
- Testing unreleased features
- Contributing to upstream projects
- Coordinating changes across projects
Pinning to specific versions
Pinning to specific versions
Use tags for reproducible builds:Best for:
- Production deployments
- Published packages
- Reproducible research
Monorepo packages
Monorepo packages
Build multiple packages from one repository:
Vendoring dependencies
Vendoring dependencies
Keep third-party sources in your repository:
Separate source and build configs
Separate source and build configs
Keep build configuration separate from source:
Authentication for Private Repositories
For private git repositories, use SSH or credentials:SSH Keys
Git Credentials
Configure git credentials manager:Best Practices
Prefer tags over branches
Prefer tags over branches
Document source choices
Document source choices
Comment why you’re using a specific source:
Keep source close to config
Keep source close to config
When possible, keep source and config together:Rather than:
Use submodules for vendored deps
Use submodules for vendored deps
For vendored dependencies:Better than copying source directly.
Source Configuration Reference
Path Source
- Relative paths: From package manifest location
- Absolute paths: Full system paths (not recommended)
- Works with: All backends
Git Source
- git: Repository URL (HTTPS or SSH)
- branch: Branch name (changes over time)
- tag: Tag name (stable, recommended)
- rev: Commit hash (most specific)
- subdirectory: Path within repository
Only one of
branch, tag, or rev can be specified. If none is given, uses the default branch.Next Steps
Workspaces
Manage multiple packages with different sources
Build Backends
How backends locate and use source code
Getting Started
Complete build configuration guide
C++ Packages
Building C++ from custom sources
Troubleshooting
Source not found
Source not found
Verify the path is correct relative to the manifest:
Git clone fails
Git clone fails
Check:
- Repository URL is correct
- Repository is accessible (public or authenticated)
- Branch/tag/revision exists
Subdirectory not found
Subdirectory not found
Ensure the subdirectory exists at the specified location:
Build can't find source files
Build can't find source files
Backends look for specific files:
- cmake:
CMakeLists.txt - python:
pyproject.tomlorsetup.py - rust:
Cargo.toml