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

Contents

Setup and activation

From a project with gleam.toml:

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

The shell supplies a Gleam wrapper, Erlang and Node.js. Start your editor from this shell to use the same dependencies with gleam lsp. You can install the wrapper through your usual Nix configuration.

Commit manifest.toml and gleam-purifier.lock.json; ignore .gleam-purifier/ and the native build/ directory. The wrapper uses a private package directory backed by Nix-verified sources. Native compiled outputs remain in build/.

Without a companion lock, the wrapper warns and runs ordinary, impure Gleam. Invalid or stale locks fail with a repair instruction.

Version compatibility

Tool or language Packaged defaults Tested versions
Gleam 1.19.2 —
Erlang/OTP 28.5.0.8 —

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

gleam-purifier lock
gleam-purifier update gleam_stdlib
gleam-purifier update

Gleam resolves versions and writes its native lock. Nix fetches the Hex archives using its checksums; native Gleam extracts and prepares them. lock retains valid selections; update NAME updates that dependency, and update updates the graph. Use the helper for dependency changes; guarded gleam add, remove, update and new are rejected.

prefetch roots the dependency environment and SDK. Build, test, run and editor commands execute in your working tree.

External locks

gleam-purifier \
  --project ./app \
  --lockfile ./locks/companion.json \
  --tool-lockfile ./locks/manifest.toml \
  lock

export GLEAM_PURIFIER_LOCKFILE="$PWD/locks/companion.json"
export GLEAM_PURIFIER_TOOL_LOCKFILE="$PWD/locks/manifest.toml"
cd app
gleam build

The scoped Gleam SDK reads the selected native lock directly, preserving the working tree’s manifest.toml. --native-lock and GLEAM_PURIFIER_NATIVE_LOCKFILE also select the native lock.

Using locked dependencies

Locked, Nix-resolved dependencies for Gleam.

Nix builds

The overlay exposes pkgs.gleam-purifier.buildGleamProject:

pkgs.gleam-purifier.buildGleamProject {
  src = ./.;
}

It returns packages, tests, release and fetches. packages.project builds and tests the project; packages.environment prepares dependencies. Output names and fetches are available during evaluation without building. lockFile and manifestLock select external locks, target selects "erlang" or "javascript", and test = false skips tests.

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.

gleam-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. Authentication uses ordinary gh configuration.

Supported scope

Scope

Supports Hex packages built by Gleam, for Erlang and JavaScript targets. Git/path dependencies and packages built by Mix or rebar3 are not yet supported. The SDK targets x86_64-linux and aarch64-linux.

Target systems

  • x86_64-linux
  • aarch64-linux