Skip to main content
Pixi’s task system allows you to define, organize, and run commands in your workspace. Tasks handle everything from building and testing to deployment, making complex workflows simple and reproducible.

Quick Start

Define tasks in your pixi.toml:
Run tasks with:

Task Dependencies

Tasks can depend on other tasks, creating complete pipelines:
When you run pixi run start:
  1. First configure runs (no dependencies)
  2. Then build runs (depends on configure)
  3. Finally start runs (depends on build)
If any task fails (exits with non-zero code), the pipeline stops and subsequent tasks won’t run.

Shorthand Syntax for Aliases

Create task aliases that run multiple tasks:
Run both with a single command:

Cross-Environment Dependencies

Run dependent tasks in different environments:
The environment specified in task dependencies takes precedence over the --environment CLI flag.

Working Directory

Specify where a task runs using cwd:
The path is relative to your workspace root (where pixi.toml lives).

Default Environment

Set which environment runs a task by default:
Override with the --environment flag:

Task Arguments

Make tasks reusable with arguments:
Use them:
Argument names cannot contain dashes (-) - use underscores (_) or camelCase instead.

Passing Extra Arguments

Use -- to pass additional flags to the command:

Arguments in Dependencies

Pass arguments to dependent tasks:

MiniJinja Templating

Task commands support MiniJinja templating for dynamic values:

Pixi Variables

Pixi automatically provides system variables in templates: Example usage:
Templating only works for tasks defined in your manifest. Use pixi run --templated for ad-hoc CLI commands.

Task Names

Task naming rules:
  • No spaces allowed
  • Must be unique
  • Names starting with _ are hidden from pixi task list
Hidden tasks are useful for internal tasks that users don’t need to see.

Caching

Specify inputs and outputs to cache task results:
Pixi caches results when:
  • No packages in the environment have changed
  • Input files haven’t changed (compared by fingerprint)
  • Output files exist and haven’t been modified
  • The command is the same
Use pixi run -v to see which files are selected by glob patterns for debugging.

Template Variables in Inputs/Outputs

Environment Variables

Set environment variables for tasks:
Values in tasks.<name>.env are interpreted by the task shell, so shell expansions like env = { VAR = "$FOO" } work cross-platform.

Clean Environment

Run tasks in an isolated environment with minimal variables:
Or from the command line:
clean-env is not supported on Windows due to system dependencies and compiler requirements.

Task Runner: deno_task_shell

Pixi uses deno_task_shell for cross-platform task execution. It’s a limited Bourne shell implementation that works on Windows, macOS, and Linux.

Built-in Commands

  • cp - Copy files
  • mv - Move files
  • rm - Remove files/directories (use rm -rf for recursive)
  • mkdir - Make directories (use mkdir -p for parents)
  • pwd - Print working directory
  • sleep - Delay (e.g., sleep 1, sleep 0.5, sleep 1m)
  • echo - Display text
  • cat - Concatenate and output files
  • exit - Exit shell
  • unset - Unset environment variables
  • xargs - Build arguments from stdin

Syntax Features

Boolean lists:
Sequential lists:
Environment variables:
Shell variables:
Pipelines:
Command substitution:
Redirects:
Glob expansion:
Negate exit code:

Real-World Example

Here’s a complete example from the cpp-sdl example project:
Run the complete pipeline: