c3pm manages the C3 compiler and nixpkgs revision for each project. Each user selects their own Nix backend.

C3 compiler

The default C3 version is 0.8.4. Pin a version for the project, or reset it to the default:

c3pm toolchain c3c set 0.8.4
c3pm toolchain c3c reset

Use the selected compiler inside the project environment:

c3pm shell -- c3c --version

c3pm locks github:c3lang/c3c/v<VERSION> as a source input, then overrides the nixpkgs C3 package with that version and source. Nix records the resolved source hash in .c3pm/nix/flake.lock.

nixpkgs

Set, update, or reset the nixpkgs revision for the project:

c3pm toolchain nixpkgs set github:NixOS/nixpkgs/nixpkgs-unstable
c3pm toolchain nixpkgs update
c3pm toolchain nixpkgs reset

update refreshes the locked nixpkgs input without changing its configured reference. The c3pm metadata reference describes the stored C3 and nixpkgs settings.

Inspect the project toolchain with:

c3pm toolchain show

Nix backend

c3pm uses Nix to realize the project environment. If no backend is saved, c3pm uses the nix command in PATH.

c3pm toolchain nix status
c3pm toolchain nix use system
c3pm toolchain nix use portable
c3pm toolchain nix use /opt/nix/bin/nix
c3pm toolchain nix reset

The portable backend lets c3pm download and manage nix-portable. Backend selection is user configuration rather than project metadata, so backend commands also work outside a C3 project.

For one-off overrides:

C3PM_NIX=/path/to/nix c3pm install
C3PM_NIX_PORTABLE=/path/to/nix-portable c3pm install