vcpkg-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. vcpkg-purifier is classified at maturity tier 4 (see tier assessment for details).
Contents
- Setup and activation
- Version compatibility
- Development loop
- Using locked dependencies
- Language tooling integration
- Nix builds
- Supported scope
Setup and activation
From a project with vcpkg.json and CMakeLists.txt:
Use the overview’s Quickstart for the initial command sequence. The setup details below apply to that workflow.
Commit vcpkg-lock.json and vcpkg-purifier.lock.json.
The first exports vcpkg’s native registry lock; the companion records selected
recipes, source archive hashes, features, and project configuration.
lock runs a native dependency installation to capture the required downloads.
prefetch builds those dependencies in Nix and roots their environment and the
compiler/editor toolchain against garbage collection.
The supplied vcpkg and cmake wrappers are required to activate the locked
environment. They use a private installed prefix under .vcpkg-purifier and
leave an existing vcpkg_installed tree alone. The shell also provides the
compiler, build tools, ctest, and clangd. You can install the package through
your usual Nix configuration instead of entering a shell each time.
Without a lockfile, wrappers warn and run the ordinary, impure tool, preserving
arguments, streams and exit status. A stale or invalid lock fails and asks you
to run vcpkg-purifier lock; it never silently falls back to online resolution.
Version compatibility
| Tool or language | Packaged defaults | Tested versions |
|---|---|---|
| vcpkg | 2026.06.24 | — |
| gcc | 16.2.0 | — |
Operating systems and architectures
| OS | CPU architecture | Packaged toolchain | Recorded workflow |
|---|---|---|---|
| Linux | ARM64 | Yes | Not recorded |
| Linux | x86-64 | Yes | Tested |
Development loop
vcpkg-purifier update zlib
vcpkg-purifier update
Updates use vcpkg’s native registry baseline updater. A named update preserves the other selected versions through native manifest overrides. A full update removes those automatically managed overrides, while retaining overrides you wrote yourself. In-tree updates retain the native updater’s manifest and configuration edits; commit them with the lockfiles.
lock retains saved registry references even with an empty local Git cache.
It can repair a damaged companion from native pins, or recover damaged native
pins from an unchanged companion.
Select optional native manifest features when locking:
vcpkg-purifier --feature tools lock
vcpkg-purifier prefetch
The lock holds separate profiles for x86-64 and ARM64 Linux. Run lock on each
platform you use to add its native dependency graph. Changes to project
configuration invalidate the other profiles until they are refreshed there.
Using locked dependencies
Locked, Nix-resolved dependencies for vcpkg and CMake projects.
Language tooling integration
Use the supplied clangd with the compile commands generated by CMake:
clangd --compile-commands-dir=build
The CMake wrapper supplies the locked dependency paths and SDK. Existing arguments selecting vcpkg’s standard CMake toolchain or the recorded triplet are accepted. A different toolchain, feature set, or installed prefix needs explicit integration rather than silently changing the dependency graph.
Nix builds
Locks may live outside the working copy:
vcpkg-purifier \
--lockfile ../locks/vcpkg-purifier.lock.json \
--native-lock ../locks/vcpkg-lock.json lock
vcpkg-purifier \
--lockfile ../locks/vcpkg-purifier.lock.json \
--native-lock ../locks/vcpkg-lock.json prefetch
A new external native lock starts from the working copy’s saved registry pins.
External updates leave its native manifests and lockfiles unchanged. Set
VCPKG_PURIFIER_LOCKFILE and VCPKG_PURIFIER_NATIVE_LOCKFILE to select these
locks for the normal wrappers.
Apply overlays.default and call the scoped builder for a sandboxed project
build:
pkgs.vcpkg-purifier.buildVcpkgProject {
src = ./project;
lockFile = ../locks/vcpkg-purifier.lock.json;
vcpkgLock = ../locks/vcpkg-lock.json;
}
The result exposes packages.project, packages.environment, tests,
release, and fetches. The project builder configures, builds, tests and
installs through CMake. cmakeFlags, buildTargets, test, nativeBuildInputs,
srcFilter, and caller-supplied fetchers customize it. Source releases are
deterministic tarballs containing the selected locks.
Publish that Nix-built source archive to a GitHub release with:
vcpkg-purifier publish \
--repo OWNER/PROJECT --tag v1.0.0
lib.vcpkg-purifier.readLock reads both locks into the shared entry/output/
problem shape without import-from-derivation. Archive entries carry their native
SHA-512 byte hashes. Selected recipes are exported losslessly, including binary
files and executable modes; local overlay changes invalidate the lock.
Supported scope
Native Linux x64-linux and arm64-linux triplets are supported, using public
HTTP(S) SHA-512-tagged source assets. Built-in and Git registries, local filesystem
registries, and project-relative overlay ports are resolved by native vcpkg.
Declare overlays in project configuration; ambient overlay and feature flags
are excluded from locked commands.
Local recipe changes are locked with lock; named updates of local overlays
and filesystem registries are not yet supported.
Ports that clone source repositories directly or perform other untracked
downloads cannot currently be replayed by the asset transport and fail during
the sandboxed prefetch. Cross-compilation, custom triplets, legacy CONTROL
recipes, and different host/target recipes for the same port are not supported
yet. vcpkg has no suitable project autoload plugin for this integration, so
there is no separate native plugin package to install.
Target systems
- x86_64-linux
- aarch64-linux