pixi-purifier full guide

Detailed setup, dependency management, build commands, and troubleshooting. Start with the overview for the initial commands; use the sections below for the complete setup and behavior. pixi-purifier is classified at maturity tier 4 (see tier assessment for details).

Contents

Setup and activation

In a project with pixi.toml or Pixi configuration in pyproject.toml:

Use the overview’s Quickstart for the initial command sequence. The setup details below apply to that workflow.

Use a task from your own project in place of check. Commit pixi.lock and pixi-purifier.lock.json. Prefetch creates the locked environments with Nix and connects them to Pixi’s normal .pixi/envs directory. Tasks run in your working tree. pixi shell activates the environment too.

The wrapper can be installed through your usual Nix configuration. With no purifier lock, it warns and runs ordinary, impure Pixi. Invalid or stale locks fail with a repair command.

Version compatibility

Tool or language Packaged defaults Tested versions
Pixi 0.82.1 —

Operating systems and architectures

OS CPU architecture Packaged toolchain Recorded workflow
Linux ARM64 Yes Not recorded
Linux x86-64 Yes Tested

Development loop

After changing dependencies in the manifest:

nix shell 'github:nix-purifiers/pixi-purifier'
pixi-purifier lock
pixi-purifier prefetch
pixi run check

Relocking preserves the native resolution. To update everything or selected packages through Pixi’s solver:

pixi-purifier update
pixi-purifier update python
pixi-purifier prefetch

The wrapper runs tasks and shells offline against the prebuilt environment. Dependency-changing native commands direct you to edit the manifest and use pixi-purifier lock or update. The environment itself is read-only; source files and task outputs remain in the project.

When adopting an existing project, prefetch retains its generated native environments at .pixi/purifier-native-envs. Removing the purifier lock makes the wrapper restore that directory before returning to ordinary Pixi. Unrelated environment symlinks are never replaced automatically.

Using locked dependencies

Locked, Nix-resolved dependencies for Pixi.

Working offline

nix shell 'github:nix-purifiers/pixi-purifier'
pixi-purifier prefetch
pixi run check
pixi shell

Prefetch keeps GC roots for the environments, archives, CLI, toolchain and Python editor worker beside the selected lock. It installs the environments available for the current platform. Conda packages and locked PyPI wheels are supplied from Nix store files, with their native hashes checked. Normal task execution uses Pixi’s --no-install and --frozen behavior. No generated project Nix files or development shell are required.

Language tooling integration

For a Python environment, select .pixi/envs/default/bin/python as the editor’s interpreter. For another environment, substitute its name. Prefetch supplies pyright and pyright-langserver in the wrapper package; start the editor from the same nix shell so those workers are available. Language servers declared as environment dependencies are available through pixi shell as well.

The editor check starts a real language server and verifies that its definition lookup reaches the locked idna package in the environment.

Supported scope

Supported language repositories

HTTP(S) Conda archives and locked PyPI wheels are supported with native Pixi lock format 7. The flake targets x86_64 and ARM Linux. Git/path dependencies, PyPI source builds, and Pixi source-build backends are not yet supported. The native block YAML format is parsed during Nix evaluation without import-from-derivation; unsupported YAML forms fail with a repair command.

Coordinates, platform selections and archive hashes remain in pixi.lock. The companion records input fingerprints, its content hash, the Pixi version, and SHA-256 hashes only where the native record lacks them. Downloads use the shared fetcher interface and may be replaced through fetchers.

No native Pixi plugin repository is needed. GitHub Pages hosts these docs.

Target systems

  • x86_64-linux
  • aarch64-linux

Troubleshooting

Native and companion locks can live outside the source:

pixi-purifier \
  --pixi-lock ../locks/pixi.lock \
  --lockfile ../locks/pixi.json lock
pixi-purifier \
  --pixi-lock ../locks/pixi.lock \
  --lockfile ../locks/pixi.json prefetch

Set PIXI_PURIFIER_PIXI_LOCK and PIXI_PURIFIER_LOCKFILE to the same paths when using the wrapper. A missing external native lock starts from the working tree’s native lock. Both commands leave that working copy alone. Use --manifest PATH / PIXI_PURIFIER_MANIFEST to select a manifest for the CLI; the native wrapper also recognizes Pixi’s --manifest-path.

Examples

examples/python combines Conda Python and the PyPI idna wheel, locked for both supported architectures:

nix shell 'github:nix-purifiers/pixi-purifier'
cd examples/python
pixi-purifier prefetch
pixi run check

The checks install and run that environment in the Nix sandbox, compare the pure YAML parser with the native format, test editor imports, reject stale, tampered, incomplete and malformed locks, and use external locks. Host tests exercise named updates against a real local Conda channel, then shut the server down before executing tasks and building a release.

Optional Nix build

The overlay adds only the pixi-purifier scope:

let
  pkgs = import nixpkgs {
    inherit system;
    overlays = [ purifier.overlays.default ];
  };
  project = pkgs.pixi-purifier.buildPixiProject {
    src = ./.;
    pixiLock = ../locks/pixi.lock;
    lockFile = ../locks/pixi.json;
  };
in {
  packages.default = project.packages.environment;
  checks.default = project.tests;
}

packages contains each locked environment available on the current platform; packages.environment selects default or the first available environment. The result also exposes tests, release and fetches. The builder accepts manifestFile, fetchers and testCommand, and named callPackage dependencies support scope overrides. The default test runs the project’s check task; override testCommand for a different suite.

release is a deterministic source archive containing the selected locks. To upload that Nix-built artifact to a GitHub release:

pixi-purifier publish \
  --repo OWNER/PROJECT --tag v1.0.0

lib.pixi-purifier.readLock exposes the shared in-memory lock shape. CI checks environment and release reproducibility with nix build --rebuild.