lake-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. lake-purifier is classified at maturity tier 4 (see tier assessment for details).
Contents
- Setup and activation
- Version compatibility
- Using locked dependencies
- Nix builds
- Project projections
- Supported scope
Setup and activation
Start in a Lake project using the supplied Lean version.
Use the overview’s Quickstart for the initial command sequence. The setup details below apply to that workflow.
The shell supplies a Lake wrapper and pinned Lean compiler. Dependencies are
compiled by Nix; Lake reuses their readonly .olean files and native libraries
while compiling your source in its normal .lake/build directory. Both
lakefile.toml and lakefile.lean are supported.
Without a companion lockfile, the wrapper warns and runs ordinary, impure Lake.
A stale or invalid lock fails. Commit lake-manifest.json and
lake-purifier.lock.json. Refresh dependency selection with:
lake-purifier lock --update
Source edits do not require relocking. Track additional configuration inputs
with lock --input path. prefetch prepares the compiled dependencies. The
wrapper can also be installed using your normal Nix configuration.
Version compatibility
| Tool or language | Packaged defaults | Tested versions |
|---|---|---|
| Lean distribution (provides Lake) | 4.35.0 | — |
| Lean | 4.35.0 | — |
Operating systems and architectures
| OS | CPU architecture | Packaged toolchain | Recorded workflow |
|---|---|---|---|
| Linux | ARM64 | Yes | Not recorded |
| Linux | x86-64 | Yes | Tested |
Using locked dependencies
Dependency resolution
Locked, Nix-resolved dependencies for Lean and Lake.
Native tooling
lake env lean MyModule.lean
lake serve
Lake’s environment and language server use the same Nix dependency paths as the compiler. Dependency source remains available for navigation. An existing local package checkout or cache does not select dependencies in a locked session.
Nix builds
An optional project definition can use the overlay’s named builder:
pkgs.lake-purifier.buildLeanProject {
src = ./.;
doCheck = true;
checkPhase = ".lake/build/bin/my-tests";
}
It exposes evaluation-known packages, tests, release and fetches.
packages.environment describes the compiled dependencies;
packages.project contains the complete compiled package. Override
buildTargets, nativeBuildInputs or installPhase for the project.
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.
lake-purifier bundle
lake-purifier publish --tag v0.1.0
bundle produces a reproducible native Lake build-cache archive. A matching
source checkout can consume it with lake unpack path/to/archive.tgz.
publish uploads those exact bytes to an existing GitHub release using Lake’s
gh release upload protocol. It does not create a source release or publish to
Reservoir.
Use --project and --lock for an external companion. Native commands accept
LAKE_PURIFIER_PROJECT and LAKE_PURIFIER_LOCK. Environment profiles retain the
compiled dependencies and wrapper SDK as Nix garbage collector roots.
Supported scope
Scope
The native Lake resolver selects the transitive Git graph. The companion records
exact revisions, Nix source hashes, native package metadata, build targets,
configuration inputs and SDK identity. Dependency metadata is checked again
before compilation. The prepared environment supplies native --packages
overrides for the entire graph.
This version supports Lean 4.35.0 and Git dependencies without subdirectories.
Local dependency workspaces, alternate toolchains, Reservoir release downloads
and arbitrary extra downloads in custom build scripts are outside its current
scope. Use leanprover/lean4:v4.35.0 in lean-toolchain. Dependency libraries
selected by their native default targets are compiled with the static facet;
if no library is a default target, all declared libraries are prepared.
Target systems
- x86_64-linux
- aarch64-linux