Skip to main content
Learn how to specify package source locations using paths, git repositories, or URLs.

Default Behavior

By default, build backends look for source code in the directory containing the package manifest:
Build backends have reasonable defaults:
  • pixi-build-cmake looks for CMakeLists.txt in the package directory
  • pixi-build-python looks for pyproject.toml or setup.py in the package directory
  • pixi-build-rust looks for Cargo.toml in 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, use package.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
Pixi clones the repository and builds from it.

Pinning to a Branch

pixi.toml
Always builds from the latest commit on the specified branch.
Using branches creates non-reproducible builds. Prefer tags or revisions for production.

Pinning to a Tag

pixi.toml
Builds from a specific release tag - recommended for reproducibility.

Pinning to a Commit

pixi.toml
Builds from an exact commit hash - most reproducible option.

Git Subdirectory

If the package is in a subdirectory of the repository:
pixi.toml
Common in monorepos:

Complete Examples

SDL Example from Git

pixi.toml

Python Package with Custom Path

pixi.toml

Multiple Packages from Different Sources

pixi.toml
  1. Local package in root directory
  2. Vendored third-party library
  3. Upstream package with custom source configuration
packages/upstream/pixi.toml

Source Configuration Patterns

Use Cases

Use a git branch to depend on development versions:
Useful for:
  • Testing unreleased features
  • Contributing to upstream projects
  • Coordinating changes across projects
Use tags for reproducible builds:
Best for:
  • Production deployments
  • Published packages
  • Reproducible research
Build multiple packages from one repository:
Keep third-party sources in your repository:
Keep build configuration separate from source:

Authentication for Private Repositories

For private git repositories, use SSH or credentials:

SSH Keys

Ensure your SSH keys are configured:

Git Credentials

Configure git credentials manager:
Then use HTTPS URLs:

Best Practices

For reproducibility:
Comment why you’re using a specific source:
When possible, keep source and config together:
Rather than:
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

Verify the path is correct relative to the manifest:
Check:
  1. Repository URL is correct
  2. Repository is accessible (public or authenticated)
  3. Branch/tag/revision exists
Ensure the subdirectory exists at the specified location:
Backends look for specific files:
  • cmake: CMakeLists.txt
  • python: pyproject.toml or setup.py
  • rust: Cargo.toml
Ensure these exist in the source location.