soldeer-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. soldeer-purifier is classified at maturity tier 4 (see tier assessment for details).

Contents

Setup and activation

In your existing Foundry project:

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

Commit soldeer.lock, soldeer-purifier.lock.json and the native remappings. Versions, URLs and archive checksums stay in Soldeer’s lock. The companion adds configuration fingerprints, Git NAR hashes and extraction metadata. Forge runs in your working tree using Nix-resolved dependencies and compiler.

This integration requires the supplied Forge wrapper. You can install it through your normal Nix configuration. Without a purifier lock it warns and runs ordinary, impure Forge. Invalid or stale locks fail with a repair command.

Version compatibility

Tool or language Packaged defaults Tested versions
Foundry distribution (provides forge soldeer) 1.8.4 —
Solidity 0.8.33 —

Operating systems and architectures

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

Development loop

Edit dependencies in foundry.toml or soldeer.toml, then:

soldeer-purifier lock
soldeer-purifier prefetch
forge build
forge test

lock retains native selections, including pinned Git revisions when a branch moves. Unchanged locks are byte-for-byte stable. To change selections:

soldeer-purifier update
soldeer-purifier prefetch

Soldeer has no targeted update operation; named updates are not supported. Dependency changes go through the purifier CLI. Ordinary source edits do not require relocking; configuration and remapping edits do.

Using locked dependencies

Locked, Nix-resolved Solidity dependencies for Soldeer and Forge.

Working offline

Prefetch roots the dependencies, Forge, Solidity compiler and editor worker. The Forge wrapper builds and tests with --offline and the locked compiler. The native project cache is materialized from immutable Nix store sources. The wrapper checks materialized files against their recorded content before builds and rejects changed dependencies. Existing entries are retained with .before-purifier suffixes when first replaced.

soldeer-purifier prefetch
forge build
forge test

Language tooling integration

Run vscode-solidity-server --stdio from the same shell. The project keeps its native remappings, and dependency sources are available in dependencies. The language-server check resolves a definition into locked forge-std sources.

Supported scope

Supported language repositories

Public Soldeer registry packages, public ZIP URLs and Git dependencies are supported. Git sources use the native locked revision and a NAR hash. Recursive Soldeer dependencies, private packages without stable URLs and names requiring platform-dependent filename sanitization are not supported. Use one of foundry.toml or soldeer.toml. Native lock format 2 requires Soldeer 0.12, supplied by Forge 1.8.4. The flake targets x86_64 and ARM Linux.

No native plugin repository is needed. GitHub Pages hosts the documentation.

Target systems

  • x86_64-linux
  • aarch64-linux

Troubleshooting

External locks leave the working tree’s native lock unchanged:

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

Set SOLDEER_PURIFIER_SOLDEER_LOCK and SOLDEER_PURIFIER_LOCKFILE to the same paths for the Forge wrapper. A missing external native lock starts from the working copy’s lock.

Examples

examples/counter imports forge-std and runs a real Solidity test:

nix shell 'github:nix-purifiers/soldeer-purifier'
cd examples/counter
soldeer-purifier prefetch
forge test

Optional Nix build

The overlay adds only the soldeer-purifier scope:

let
  pkgs = import nixpkgs {
    inherit system;
    overlays = [ purifier.overlays.default ];
  };
  project = pkgs.soldeer-purifier.buildSoldeerProject {
    src = ./.;
    soldeerLock = ../locks/soldeer.lock;
    lockFile = ../locks/soldeer.json;
  };
in {
  packages.default = project.packages.contracts;
  checks.default = project.tests;
}

The result exposes packages.contracts, tests, release and fetches. The builder supports fetchers, srcFilter, testCommand and scope overrides. release contains deterministic source and compiled contract archives:

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

lib.soldeer-purifier.readLock reads the native TOML and companion JSON during Nix evaluation, without import-from-derivation.