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

Contents

Setup and activation

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

Prefetch prepares Nimble’s normal config.nims and nimble.paths integration, including task dependencies. The shell supplies Nim, Nimble, the C/C++ compiler and nimlangserver. You can install the wrapper through your usual Nix configuration.

Commit nimble.lock and nimble-purifier.lock.json; ignore .nimble-purifier/, nimble.paths and generated executables. Without a companion lock, the wrapper warns on standard error and runs ordinary, impure Nimble with its normal configuration. Invalid or stale locks fail with a repair instruction.

Version compatibility

Tool or language Packaged defaults Tested versions
Nimble 0.26.0 —
Nim 2.2.12 —

Operating systems and architectures

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

Development loop

Lock and update

nimble-purifier lock
nimble-purifier update results
nimble-purifier update

Native Nimble selects versions, exact Git revisions, checksums and task requirements. The companion records those selections and source-tree hashes. Host-built packages are excluded. Nix fetches the pinned Git trees and runs native Nimble offline to prepare the complete dependency graph.

lock retains compatible native selections. Named updates use Nimble’s native lock --refresh NAME; an unnamed update refreshes the graph within the manifest’s requirements.

Development commands use a private native directory backed by immutable Nix packages. Existing global caches and local nimbledeps directories cannot replace them. Task subprocesses inherit the same lock, directory and offline mode. Application source edits do not rebuild dependencies; manifest changes require relocking.

External locks

nimble-purifier \
  --project ./app \
  --lockfile ./locks/companion.json \
  --tool-lockfile ./locks/nimble.lock \
  lock

export NIMBLE_PURIFIER_LOCKFILE="$PWD/locks/companion.json"
export NIMBLE_PURIFIER_TOOL_LOCKFILE="$PWD/locks/nimble.lock"
cd app
nimble build

The working tree’s native lock remains untouched. --native-lock and NIMBLE_PURIFIER_NATIVE_LOCKFILE are equivalent native-lock selectors. Compatible platform profiles are retained in one companion; run lock on each platform you use.

Using locked dependencies

Locked, Nix-resolved dependencies for Nimble.

Language tooling integration

After prefetch, use the normal compiler and editor commands:

nim check src/example.nim
nimlangserver

Nim reads the native project configuration and locked dependency paths. The setup preserves custom content in an existing config.nims.

Nix builds

The overlay exposes pkgs.nimble-purifier.buildNimbleProject:

pkgs.nimble-purifier.buildNimbleProject {
  src = ./.;
}

It returns packages, tests, release and fetches. packages.environment prepares dependencies; packages.project builds, tests and installs declared executables. lockFile, nimbleLock, nativeBuildInputs, fetchers, srcFilter, doCheck, buildCommand and installCommand customize the build. Output names are available during evaluation without building dependencies.

Project projections

This integration provides native release artifacts, rather than a typed cross-purifier project projection interface. The publication workflow below uses those native artifacts.

nimble-purifier publish \
  --repo OWNER/REPOSITORY \
  --tag v0.1.0

This creates or updates a GitHub release with a deterministic Nix-built source archive containing both locks. It uses normal gh authentication. Declared binaries and compiler outputs beside their .nim sources are excluded from the archive.

Supported scope

Scope

Supports public HTTPS Git dependencies with native Nimble 0.26.0 locks, including task graphs, and the supplied Nim 2.2.12 Linux SDK with C/C++ backends. Project paths must stay inside the working tree. Explicit Nim compiler lock entries, local/develop dependencies, Mercurial, repository subdirectories and Git submodules are not yet supported. Manifest-local NimScript imports and VCS-derived project metadata are also outside the initial scope.

Dependency-changing flags and native mutation commands such as install, add, develop, refresh and publish are guarded in locked sessions. Use the helper for lock updates and source releases. Native build, test, run, shell, setup and inspection commands use the prepared environment.

Target systems

  • x86_64-linux
  • aarch64-linux