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

Contents

Setup and activation

From a project with shard.yml:

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

The shell supplies wrappers for shards, crystal and crystalline. They use a private dependency directory under .shards-purifier/, leaving an existing lib/ alone. Start your editor from this shell to use the prepared dependencies with Crystalline. No generated devshell is needed. You can install these wrappers through your usual Nix configuration.

Without a companion lockfile, wrappers warn and run the ordinary, impure tool. Invalid or stale locks fail with a repair instruction.

Commit shard.lock and shards-purifier.lock.json. Ignore .shards-purifier/ and generated bin/ files.

Version compatibility

Tool or language Packaged defaults Tested versions
Shards 0.20.0 —
Crystal 1.21.1 —

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

shards-purifier lock
shards-purifier update db
shards-purifier update

Shards resolves the graph. The companion records exact Git commits, source hashes and the native cache layout. Semantic version selections use Shards’ native +git.commit. lock syntax, retaining the exact revision when a tag moves. lock retains valid selections; update NAME asks Shards to update that dependency, and update updates the graph.

prefetch realizes dependencies with Nix, executes native installation and postinstall hooks in the sandbox, and roots the environment and SDK. Builds, tests and editor commands run in your working tree. Native hooks must work offline from their declared inputs.

Use the helper for dependency changes. Guarded shards update, lock, init, prune and outdated commands are rejected rather than changing the sealed graph.

External locks

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

export SHARDS_PURIFIER_LOCKFILE="$PWD/locks/companion.json"
export SHARDS_PURIFIER_TOOL_LOCKFILE="$PWD/locks/shard.lock"
cd app
shards build

The selected native lock is read directly by the scoped Shards SDK. The working tree’s shard.lock is not rewritten by guarded commands. --native-lock and SHARDS_PURIFIER_NATIVE_LOCKFILE are equivalent native-lock selectors.

Using locked dependencies

Locked, Nix-resolved dependencies for Crystal’s Shards.

Nix builds

The overlay exposes pkgs.shards-purifier.buildShardsProject:

pkgs.shards-purifier.buildShardsProject {
  src = ./.;
}

It returns packages, tests, release and fetches. packages.project builds native targets and runs specs; packages.environment supplies prepared dependencies. Output names and fetch declarations are available during evaluation without building. lockFile and shardLock select external locks; buildTargets selects native targets, and test = false skips specs.

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.

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

This publishes a deterministic Nix-built source archive containing both locks. It creates a GitHub release or replaces the archive on an existing release. Authentication uses the ordinary gh configuration.

Supported scope

Scope

Supports native Git shards over public HTTP(S) and Git transports, including GitHub shorthand, development dependencies and native targets. Path dependencies, dependency overrides and Git submodules are not yet supported. Private credentials are not captured. Postinstall downloads or undeclared external tools fail during sandboxed prefetch.

The SDK currently targets x86_64-linux and aarch64-linux.

Target systems

  • x86_64-linux
  • aarch64-linux