Toolbox is a self-contained, data-driven package registry for turnkey. Version metadata lives in JSON data files — Nix code reads this data to build derivations automatically. Adding a new version means adding a JSON entry, not editing Nix code.
Every derivation must build identically from pinned inputs, forever. A build whose output depends on when it runs is a bug, not a convenience.
- Pin everything by content hash. Source archives (
sha256), Go deps (vendorHash), Rust deps (cargoHash), and dependency trees are all fixed-output. Never leave a hash to be resolved "live" at build time. - Never resolve version ranges at build time. If a package's dependencies are expressed as semver ranges (npm
^/~, etc.), resolving them during the build ties the output to the registry's state on that day — a rebuild months later can silently pull different transitive versions. This is unacceptable. The fully-resolved tree must come from a lockfile (see below). - Use upstream's own lockfile. Upstream already resolved and tested a specific dependency tree; their committed lockfile is the source of truth. Do not regenerate or re-resolve it — build from the source tree that contains it so a Nix dep-fetcher consumes it directly.
- Fail loudly, never drift silently. Prefer tools that verify a lockfile (
npm ci,pnpm --frozen-lockfile,cargo --locked) over ones that will happily update it. If pinned inputs no longer match, the build must error, not paper over it.
The failure mode to design against: "it built for me today." If it won't build byte-identically in a year, it isn't done.
Build from the tagged source repository, not the published npm tarball. The npm registry tarball ships compiled output but usually no lockfile, which would force you to re-resolve dependencies — exactly what must not happen. The source repo contains the committed lockfile; build from it so a Nix dep-fetcher pins the tree upstream actually tested.
Pick the fetcher by the lockfile upstream commits:
- pnpm (
pnpm-lock.yaml): usebuildNpmPackagewithnpmDeps = nullandpnpmDeps = fetchPnpmDeps { … }. Drive the install with toolbox's own pinned pnpm (toolbox.pnpm.versions.${versionData.pnpm}), not nixpkgs' — upstream'spackageManagerfield often names an EOL pnpm that nixpkgs marks insecure, and what actually has to hold is that the pnpm you use can read the lockfile'slockfileVersion, not that it matches upstream's major. SetfetcherVersion = 4(reproducible tarball). Reference:packages/openspec/:pkgs.buildNpmPackage (finalAttrs: { pname = "openspec"; inherit version; src = pkgs.fetchFromGitHub { owner = "…"; repo = "…"; rev = "v${version}"; hash = versionData.sha256; }; npmDeps = null; pnpmDeps = pkgs.fetchPnpmDeps { inherit (finalAttrs) pname version src; inherit pnpm; # toolbox.pnpm.versions.${versionData.pnpm} fetcherVersion = 4; hash = versionData.pnpmDeps; # the only dep hash in data.json }; nativeBuildInputs = [ pnpm ]; npmConfigHook = pkgs.pnpmConfigHook; dontNpmPrune = true; # node_modules is pnpm-managed });
- npm (
package-lock.json): plainbuildNpmPackagewithnpmDepsHash = versionData.npmDepsHash;(it reads the committed lock viafetchNpmDeps). - yarn (
yarn.lock):fetchYarnDeps/yarnConfigHook.
The dep hash (pnpmDeps/npmDepsHash) can't be precomputed — set it to lib.fakeHash (sha256-AAAA…), build, and copy the got: value into data.json. The dep-fetcher FODs already include pkgs.cacert, so TLS works.
Last resort — vendoring a lockfile. Only when upstream ships no usable lockfile anywhere (not in the repo, not in the tarball) may you generate one. Then vendor it version-namespaced like a patch — package-lock-<version>.json (never a shared name), generated with npm install --package-lock-only --ignore-scripts, referenced as ${./. + "/package-lock-${version}.json"}, and installed with npm ci (never npm install). A vendored, self-generated lock is strictly worse than upstream's — it pins a tree, not the tested tree — so reach for it only when there is no alternative, and say so in a comment.
toolbox/
├── flake.nix # Flake assembly: auto-discovers packages/, exposes registry + packages
├── lib/
│ ├── default.nix # Registry helpers (resolveTool, readData, buildPackage, buildVersions, buildToolchain, resolvePatches, availableVersions, versionToAttr)
│ ├── prebuilt-binary.nix # buildPrebuiltBinary: tools shipped as prebuilt per-platform binaries
│ ├── rust-package.nix # buildRustPackage: Rust built from a tagged GitHub source
│ ├── go-package.nix # buildGoPackage: Go built from a tagged GitHub source
│ ├── uv-package.nix # buildUvApplication: Python built from a tagged GitHub source + its uv.lock
│ ├── skill-bundle.nix # buildSkillBundle: Claude Code skill bundles
│ └── check-registry.nix # checkRegistry: eval-time invariants, wired to `nix flake check`
└── packages/
├── go/
│ ├── default.nix # Go builder: builds Go from source using pkgs.go as bootstrap
│ └── data.json # Version metadata: { "1.25.6": { "sha256": "..." } }
└── beads/
├── default.nix # Beads builder: buildGoModule with toolbox Go
└── data.json # Version metadata: { "0.52.0": { "sha256": "...", "go": "1.25.6" } }
Each package directory has a data.json with version entries and a _meta key:
{
"_meta": { "default": "1.2.3", "releases": "https://github.com/OWNER/REPO/releases" },
"1.2.3": {
"sha256": "sha256-XXXX",
"vendorHash": "sha256-YYYY"
}
}_meta.default: Which version is the default (used bynix build .#<pkg>.default)_meta.releases: URL to the upstream releases page (e.g., GitHub releases, official download page). Read by the builder into the entry'stoolboxstamp, from which the docs generator links package names; also used by agents to check for new versions._meta.inactive: (optional) Whentrue, the package is no longer actively maintained — no new versions will be added. Existing versions remain fully functional. Inactive packages are skipped by update checks and shown with reduced emphasis in generated docs. To mark a package inactive, add"inactive": trueto its_metaobject.- Version keys: Semantic version strings (e.g.,
"1.25.6","0.52.0") sha256: SRI hash of the source archivevendorHash: (Go packages) SRI hash of vendored dependenciesgo: (Go packages) Go version from toolbox to build withbuilder: (optional) Builder variant name; defaults to"default"rustSrc: (rust){ "sha256": "…" }, the raw-file hash of the platform-independentrust-src-<version>.tar.xz(nix-prefetch-url, no--unpack). Required: it is exposed aspassthru.rustSrc, which the rust template'sRUST_SRC_PATHpoints atrev: (buck2) the buck2 commit the release tag points at (gh api repos/facebook/buck2/commits/<tag> --jq .sha). Required: it is exposed aspassthru.rev, which turnkey checks against its pinned release
Match the prefetch tool to the Nix fetcher used in default.nix:
For fetchFromGitHub / fetchzip (hashes unpacked content — use --unpack):
nix-prefetch-url --type sha256 --unpack https://github.com/OWNER/REPO/archive/refs/tags/vX.Y.Z.tar.gz
nix hash convert --hash-algo sha256 --to sri <hash>For fetchurl (hashes the raw downloaded file — do NOT use --unpack):
nix-prefetch-url --type sha256 https://example.com/package-X.Y.Z.tar.gz
nix hash convert --hash-algo sha256 --to sri <hash>fetchurl downloads the file as-is; the builder's unpackPhase extracts it. fetchFromGitHub unpacks and strips the top-level directory before hashing. Using the wrong prefetch mode produces a hash mismatch at build time.
{
"_meta": { "default": "0.53.0" },
"0.53.0": {
"sha256": "sha256-COMPUTED_HASH",
"vendorHash": "sha256-VENDOR_HASH",
"go": "1.25.6"
},
"0.52.0": { ... }
}Update _meta.default if this should be the new default.
If you don't know the vendorHash, set it to "" and attempt a build:
nix build .#beads.0_53_0The build will fail with a message like:
hash mismatch in fixed-output derivation ...
got: sha256-ACTUAL_HASH
Use the "got:" hash as the vendorHash.
nix build .#beads.0_53_0
./result/bin/bd versionmkdir packages/mypackage{
"_meta": { "default": "1.0.0", "releases": "https://github.com/OWNER/REPO/releases" },
"1.0.0": {
"sha256": "sha256-XXXX"
}
}The builder must be a function that takes { pkgs, lib, toolbox, toolboxLib } and returns:
{
versions = { "1.0.0" = <derivation>; ... };
default = "1.0.0"; # Must match _meta.default
}Full template:
{ pkgs, lib, toolbox, toolboxLib }:
let
builders = {
default = version: versionData:
pkgs.stdenv.mkDerivation {
pname = "mypackage";
inherit version;
src = pkgs.fetchurl {
url = "https://example.com/mypackage-${version}.tar.gz";
hash = versionData.sha256;
};
# ... build steps ...
};
};
in
toolboxLib.buildPackage { name = "mypackage"; dataPath = ./data.json; inherit builders; }toolboxLib.buildPackage is the canonical entry point for versioned packages: it reads meta + versions from data.json, dispatches each version through builders (keyed by the optional "builder" field — see Builder Versioning), and returns the { versions; default; } shape the registry expects. It's the same shape buildToolchain and buildSkillBundle produce.
A package that does not exist everywhere does not need an escape hatch. Declare where it exists — meta.platforms, which buildPrebuiltBinary derives from its platforms table for free — and toolboxLib.availableVersions filters it out of the flake outputs on every other system. buildToolchain intersects its components' platforms, so a toolchain inherits the constraint. Do not hand-build the { versions; default; } return to work around this; every package in the registry goes through buildPackage.
toolboxLib.buildVersions remains available for a package that must genuinely pre-process its version set before building, but nothing in the registry currently needs it.
The package is auto-discovered — no changes to flake.nix needed:
nix build .#mypackage.default
nix build .#mypackage.1_0_0 # Version dots become underscoresTools distributed as prebuilt per-platform binaries or archives (no source build) use toolboxLib.buildPrebuiltBinary, which returns a builder function that slots into buildPackage's builders attrset. It hides the invariant ritual — per-system asset resolution with a throw on unsupported platforms, fetchurl against versionData.<system>.sha256, the dontConfigure/dontBuild/dontStrip trio, optional Linux autoPatchelfHook, .zip unpacking, and installing named executables into $out/bin:
{ pkgs, lib, toolbox, toolboxLib }:
let
builders.default = toolboxLib.buildPrebuiltBinary {
inherit pkgs;
pname = "jq";
platforms = {
"x86_64-linux" = "linux-amd64";
"aarch64-linux" = "linux-arm64";
"x86_64-darwin" = "macos-amd64";
"aarch64-darwin" = "macos-arm64";
};
url = { version, platform }:
"https://github.com/jqlang/jq/releases/download/jq-${version}/jq-${platform}";
binaries = [ "jq" ];
patchelf = false; # static binary
meta = with lib; { description = "…"; homepage = "…"; license = licenses.mit; };
};
in
toolboxLib.buildPackage { name = "jq"; dataPath = ./data.json; inherit builders; }The data.json for a prebuilt package nests the source hash per system (one binary per platform):
{
"_meta": { "default": "1.8.2", "releases": "https://github.com/jqlang/jq/releases" },
"1.8.2": {
"x86_64-linux": { "sha256": "sha256-…" },
"aarch64-linux": { "sha256": "sha256-…" },
"x86_64-darwin": { "sha256": "sha256-…" },
"aarch64-darwin": { "sha256": "sha256-…" }
}
}| Param | Required | Meaning |
|---|---|---|
pkgs |
yes | nixpkgs instance |
pname |
yes | package name |
platforms |
yes | system -> asset string; throws on unsupported system |
url |
yes | { version, platform } -> URL |
binaries |
yes | executables to install into $out/bin; each entry a string (installed under its basename) or { from; to; } to rename — from may be a fn { version, platform } -> string for assets whose binary is named e.g. tool-${version}-${triple} |
sourceRoot |
no | null (default) → single binary (dontUnpack); a transport-compression suffix (.zst/.gz/.xz/.bz2) is auto-detected and the binary decompressed. Else a string, or fn { version, platform } -> string, naming the unpacked dir. A flat archive is the literal string "." (not a fn returning it), unpacked into a fresh subdirectory so builders that keep their own files in the build dir still work. .zip archives get unzip automatically |
patchelf |
no | Linux autoPatchelfHook + cc.cc.lib (default true; set false for static binaries) |
extraLibs |
no | extra shared libraries for autoPatchelfHook to resolve on Linux (e.g. [ pkgs.zlib ] for libz.so.1); ignored when patchelf = false |
symlinks |
no | { link = target; } → $out/bin/<link> → $out/bin/<target> |
postInstall |
no | extra shell appended inside installPhase (shell completions, man pages, shipped asset trees, relative symlinks) |
meta |
no | derivation meta |
buildPrebuiltBinary installs named executables — including single binaries shipped transport-compressed (.zst/.gz/.xz/.bz2, decompressed automatically; e.g. buck2, rust-analyzer). Tools that install a whole toolchain tree (nodejs, python, rust, git, platform-tools, typescript) stay on plain mkDerivation — they're a different shape.
Rust and Go packages built from a tagged GitHub source use
toolboxLib.buildRustPackage / toolboxLib.buildGoPackage. Like
buildPrebuiltBinary, each returns a builder function that slots into
buildPackage's builders attrset, so the package can still grow builder
variants. They hide the invariant ritual — resolving the pinned toolchain out
of the registry (versionData.rust / versionData.go), constructing the
platform (makeRustPlatform / buildGoModule.override), fetching the tagged
source, and wiring versionData's hashes in.
{ pkgs, lib, toolbox, toolboxLib }:
let
builders.default = toolboxLib.buildRustPackage {
inherit pkgs toolbox;
pname = "cargo-edit";
owner = "killercup";
repo = "cargo-edit";
extraArgs = {
nativeBuildInputs = [ pkgs.pkg-config ];
buildInputs = [ pkgs.openssl ];
};
meta = with lib; { description = "…"; homepage = "…"; license = licenses.mit; };
};
in
toolboxLib.buildPackage { name = "cargo-edit"; dataPath = ./data.json; inherit builders; }buildGoPackage takes the same shape, plus subPackages (default [ "." ],
overridden by versionData.subPackages when the data supplies it).
| Param | Required | Meaning |
|---|---|---|
pkgs |
yes | nixpkgs instance |
toolbox |
yes | the registry, for the pinned Rust/Go |
pname |
yes | package name |
owner / repo |
yes | GitHub source |
rev |
no | fn { version } -> rev (default "v${version}"); e.g. nil uses a bare version, gopls uses "gopls/v${version}" |
subPackages |
no | (Go only) build targets, default [ "." ] |
extraArgs |
no | extra builder arguments — an attrset, or a fn { version, versionData, rust|go } -> attrset when the version or the resolved toolchain is needed. Merged last, so it overrides anything the helper sets |
meta |
no | derivation meta |
buildRustPackage sets cargoHash from versionData.cargoHash when the data
carries one. A package vendoring a lockfile instead has no cargoHash in its
data.json and supplies cargoLock through extraArgs — see packages/nil
(version-namespaced Cargo-${version}.lock) and packages/qmk_hid.
buildGoPackage always reads versionData.vendorHash.
Packages whose build is not "fetch a tagged GitHub tag and compile it" stay on
their own builders: packages/go (bootstraps Go from source), packages/nix
(meson), packages/delta (prebuilt with a source fallback, dispatching on
whether the data has an entry for this system).
Python applications whose upstream commits a uv.lock use
toolboxLib.buildUvApplication (lib/uv-package.nix). It builds a uv2nix
virtualenv from the tagged source and upstream's lock, and exposes only the
project's own entry points. nixpkgs' python package set is not used: its
versions drift from the tree upstream tested.
builders.default = toolboxLib.buildUvApplication {
inherit pkgs;
pname = "code-review-graph"; # must match the uv project name
owner = "tirth8205";
repo = "code-review-graph";
python = pkgs.python313; # optional; default pkgs.python3
meta = { … };
};Optional parameters: rev (fn { version } -> rev, default "v${version}")
and overrides (a pyproject-nix overlay for wheels or sdists that need native
fixes).
The helper reads only sha256 from data.json, the --unpack hash of the
tag: every wheel and sdist is already hash-pinned in the lock. uv2nix reads the lock at eval
time, so the helper fetches the source with builtins.fetchTarball rather than
fetchFromGitHub (which would be import-from-derivation). Pick python from
upstream's supported range: a newer interpreter can lack wheels in the lock and
fall back to sdists that fail to build. Reference: packages/code-review-graph.
Toolchains are meta-packages that bundle related tools via symlinkJoin. They use toolboxLib.buildToolchain — no custom Nix logic needed.
mkdir packages/my-toolchainComponent keys must match toolbox package names exactly:
{
"_meta": { "default": "1" },
"1": {
"mytool": "1.0.0",
"myformatter": "2.3.4"
}
}{ pkgs, lib, toolbox, toolboxLib }:
toolboxLib.buildToolchain { inherit toolbox pkgs; name = "my-toolchain"; dataPath = ./data.json; }nix build .#my-toolchain.default
nix build .#my-toolchain.1A skill bundle packages agent skills from a pinned upstream repository into a Claude Code plugin directory — .claude-plugin/plugin.json plus the selected skill directories. Downstream consumers wire the result into home-manager's programs.claude-code module as either a whole plugin or a flattened set of skills.
The generic support code is toolboxLib.buildSkillBundle (in lib/skill-bundle.nix); each bundle package is thin and data-driven, like a toolchain.
Skill selection happens inside the build sandbox with jq (a real JSON parser) reading the upstream .claude-plugin/plugin.json — never at Nix evaluation time. There is no import-from-derivation, and the output is a pure function of the pinned source hash. Which skills end up in the bundle can never depend on when the build runs.
The builder uses fetchFromGitHub, so prefetch with --unpack and pin a commit — a plugin's version field and its git tags drift independently (main may already be a version ahead of the newest tag):
nix-prefetch-url --type sha256 --unpack https://github.com/OWNER/REPO/archive/<commit>.tar.gz
nix hash convert --hash-algo sha256 --to sri <hash>{
"_meta": {
"default": "1.1.0",
"releases": "https://github.com/OWNER/REPO/releases",
"fromClaudePlugin": true
},
"1.1.0": {
"owner": "OWNER",
"repo": "REPO",
"rev": "<commit-sha>",
"sha256": "sha256-XXXX"
}
}Per-version fields:
owner/repo/rev/sha256: thefetchFromGitHubsource pin (revis a commit).fromClaudePlugin: (bool) whentrue, include only the skills listed in the upstream manifest'sskillsarray — repo extras (skills/deprecated,skills/in-progress, …) are dropped, and the upstream manifest is shipped verbatim with itsskillsarray rewritten to the selection. Whenfalse, include every directory underskills/that contains aSKILL.md, and synthesize a{ name, skills }manifest. Defaults from_meta.fromClaudePlugin, elsefalse.pluginJsonPath: (optional) manifest location; defaults to.claude-plugin/plugin.json.select/exclude: (optional) allowlist / denylist of skill basenames, applied on top of the above.excludewins overselect.
_meta.fromClaudePlugin sets the package-wide default; a version entry may override it.
{ pkgs, lib, toolbox, toolboxLib }:
toolboxLib.buildSkillBundle {
inherit pkgs;
name = "mypackage-skills";
dataPath = ./data.json;
}nix build .#mypackage-skills.default # the plugin directory
nix build .#mypackage-skills.1_1_0
jq '{name, count: (.skills | length)}' result/.claude-plugin/plugin.json
nix build .#mypackage-skills.skills # flattened one-folder-per-skill view (passthru)The bundle derivation is a plugin directory, and it exposes a flattened passthru.skills for the path form of the skills option (which cannot consume the upstream category nesting):
# As a plugin — the manifest drives what Claude Code loads:
programs.claude-code.plugins = [ inputs.toolbox.packages.${system}.mypackage-skills ];
# As a flat skills directory:
programs.claude-code.skills = "${inputs.toolbox.packages.${system}.mypackage-skills.skills}";Use one route, not both. The plugins route requires Claude Code ≥ 2.1.76 (≥ 2.1.157 for persistent personal plugins); the skills route has no version floor. Both need a home-manager recent enough to expose programs.claude-code.skills / .plugins.
A skill bundle can be a component of a toolchain (see Adding a New Toolchain); its skills/ and .claude-plugin/ trees are symlinked into the toolchain output alongside the other tools, so the toolchain is itself a plugin directory and exposes the same flattened passthru.skills.
A toolchain may hold several skill bundles. symlinkJoin alone would keep only the first .claude-plugin/plugin.json it links, so buildToolchain recognises bundles by their kind stamp and, when there are two or more, replaces the manifest with a synthesized { name, skills } listing every bundle's skills. A skill name shipped by two bundles fails the build. A toolchain with at most one bundle keeps the plain join and the bundle's own manifest.
When the build process changes across versions (new flags, different structure), add a new builder variant instead of modifying the existing one:
{
"_meta": { "default": "2.0.0" },
"1.0.0": {
"sha256": "sha256-XXXX"
},
"2.0.0": {
"sha256": "sha256-YYYY",
"builder": "v2"
}
}In default.nix:
builders = {
default = version: versionData: { ... }; # Original build logic
v2 = version: versionData: { ... }; # New build logic
};When "builder" is absent, it defaults to "default". Existing versions are never affected by new builders.
Some packages augment upstream releases with custom patches from a fork. Patches are vendored in the repository for reproducibility, with metadata about their origin for scripted regeneration.
{
"_meta": { "default": "1.0.0", "releases": "https://github.com/OWNER/REPO/releases" },
"1.0.0": {
"sha256": "sha256-XXXX",
"subPackages": ["cmd/tool", "cmd/tool-extra"],
"patches": [
{
"file": "patches/my-fork-1.0.0.patch",
"source": {
"owner": "FORK_OWNER",
"repo": "REPO",
"branch": "feature-branch",
"commit": "abc123..."
}
}
]
}
}patches[].file: Version-specific path relative to the package directory. This is what Nix reads at build time. The filename should include the base version (e.g.my-fork-1.0.0.patch) since each upstream release needs its own patch.patches[].source: Origin metadata for regeneration — not used by Nix, but used by agents/scripts to refresh the patch.subPackages: Optional, data-driven list of build targets. When absent, the builder uses its own default.
Builders opt in to patch support via toolboxLib.resolvePatches:
(pkgs.buildGoModule.override { inherit go; }) {
pname = "mypackage";
inherit version;
src = pkgs.fetchFromGitHub { ... };
patches = toolboxLib.resolvePatches ./. versionData; # [] when no patches
subPackages = versionData.subPackages or [ "cmd/tool" ];
# ...
};resolvePatches returns [] when versionData.patches is absent, so it's safe to add unconditionally — existing versions without patches are unaffected.
Use the /manage-patches skill to manage the full patch lifecycle:
/manage-patches refresh beadwork # refresh patch for default version
/manage-patches refresh beadwork 0.12.3 # refresh patch for specific version
/manage-patches rebase beadwork 0.13.0 # create patch for new upstream version
/manage-patches init mypackage 1.0.0 fork-owner repo branch # set up patches on a new package
The skill runs generate-patch (bundled in the skill directory), which fetches the diff from GitHub, verifies it applies cleanly, and updates the commit SHA in data.json. It then handles staging, building, and vendorHash discovery.
Packages can reference other toolbox packages via the toolbox argument:
{ pkgs, lib, toolbox, toolboxLib }:
# Get a specific Go version from toolbox
go = toolbox.go.versions.${versionData.go};
# Use it in buildGoModule
(pkgs.buildGoModule.override { inherit go; }) { ... }The toolbox attrset contains all packages. Lazy evaluation prevents circular dependencies as long as the dependency graph is acyclic.
registry.<system>.<pkg>.versions.<version> # Derivation
registry.<system>.<pkg>.default # Default version string
packages.<system>.<pkg>.<version_underscored> # Derivation (dots → underscores)
packages.<system>.<pkg>.default # Default version derivation
Examples:
nix build .#go.1_25_6 # Go 1.25.6
nix build .#beads.default # Default beads version
nix build .#beads.0_52_0 # Beads v0.52.0
nix run .#beads.default -- version# In turnkey's flake.nix:
inputs.toolbox.url = "github:firefly-engineering/toolbox";
# In registryExtensions:
registryExtensions = {
beads = inputs.toolbox.registry.${system}.beads;
go = inputs.toolbox.registry.${system}.go;
};Each package's data.json has a _meta.releases URL pointing to its upstream releases page. Use this to discover whether newer versions are available.
- Read
packages/<pkg>/data.jsonto find_meta.releasesand_meta.default(the current default version). If_meta.inactiveistrue, the package is no longer maintained — skip it. - Fetch the releases URL to find the latest available version(s).
- GitHub releases pages (
github.com/<owner>/<repo>/releases): use the GitHub API for structured data:Or to list recent releases:gh api repos/<owner>/<repo>/releases/latest --jq '.tag_name'
gh api repos/<owner>/<repo>/releases --jq '.[].tag_name' | head -10
- Non-GitHub pages (e.g.,
go.dev/dl/,nodejs.org,static.rust-lang.org): fetch the page and extract version information from it.
- GitHub releases pages (
- Compare the latest upstream version against
_meta.default. Note that some packages use avprefix in their version keys (e.g.,"v1.5.1") — match the convention already used in that package'sdata.json.
To scan the entire registry for outdated packages:
- Iterate over every
packages/*/data.json. - For each, extract
_meta.releasesand_meta.default. - Skip inactive packages — if
_meta.inactiveistrue, skip the package entirely. - Fetch the upstream releases URL and compare.
- Report which packages have newer versions available, showing current vs. latest.
Once you've identified that a newer version exists:
- Follow the steps in "Adding a New Version of an Existing Package" above.
- Use the URL patterns in the package's
default.nixto construct the correct download URL for the new version — this tells you how to compute the source hash. - Update
_meta.defaultto the new version. - Test the build and verify the binary.
Toolbox packages are cached on Cachix (firefly-toolbox). The flake's nixConfig automatically configures downstream consumers to use this cache.
nix build --no-link --print-out-paths --impure --expr '
builtins.attrValues (builtins.getFlake (toString ./.)).packages.aarch64-darwin
' | cachix push firefly-toolboxReplace aarch64-darwin with the target system (e.g., x86_64-linux) as needed.
Every registry entry carries a toolbox stamp alongside its versions — the
facts about a package that only its builder knows:
{
versions = { ... };
default = "1.2.3";
toolbox = {
kind = "package"; # | "toolchain" | "skill-bundle"
releases = "https://github.com/OWNER/REPO/releases"; # from _meta
inactive = false; # from _meta
components = null; # toolchains: { <version> = { <component> = <pin>; }; }
};
}buildPackage, buildToolchain and buildSkillBundle stamp this for you, so
an ordinary package needs to do nothing. If you hand-build a
{ versions; default; } return, you must stamp it too — toolboxLib.mkStamp
does it, and checkRegistry will fail the build if you don't.
packages/solana-toolchain/default.nix is the one example in the registry.
nix eval --json .#manifest serialises the whole registry from these stamps,
plus each version and the systems it is actually available on. The docs
generator consumes that manifest; it does not read packages/*/data.json.
Two consequences worth knowing:
- A package does not need a
data.jsonof its own to be documented — seepackages/tuicr-skills/, which builds from a sibling's data file and has no data file at all. _meta.releasesand_meta.inactivereach the site through the stamp, so they are read by Nix now, not only by the docs.
See ADR 0004 for why classification moved here.
After making changes:
-
nix flake check— the registry gate. RunstoolboxLib.checkRegistry(lib/check-registry.nix), which forces every system the flake advertises, not just yours, and instantiates every version without building it. This is what catches a version entry missing the hash its builder dereferences, abuildernaming no builder, a_meta.defaultthat is not among the versions, a toolchain component or cross-package pin resolving to nothing, and apatches[].filethat is not on disk.devenv needs the working directory passed in, the same way the justfile's
build-devshellrecipe does:printf '%s' "$PWD" > .devenv-root nix flake check --impure \ --override-input devenv-root "file+file://$PWD/.devenv-root"
Do not add
--all-systems. The check derivation is native, and the cross-system coverage comes from what it forces during evaluation.--all-systemsadditionally asks your machine to build the other systems' check derivations, which fails with "platform mismatch": a derivation can be instantiated anywhere, but only realised on its own system. -
nix build .#<pkg>— default version builds (.#<pkg>.<version>for a specific one) -
Verify binary output with
./result/bin/<binary> --versionor similar -
Refactoring a builder? Compare derivation paths before and after — a behaviour-preserving change must not move a single one:
nix eval --json --impure --expr ' let f = builtins.getFlake (toString ./.); pkgs = f.inputs.nixpkgs.legacyPackages.${builtins.currentSystem}; tl = import ./lib { inherit (pkgs) lib; }; in pkgs.lib.mapAttrs (_: e: pkgs.lib.mapAttrs (_: d: d.drvPath) (tl.availableVersions pkgs.stdenv.hostPlatform e)) f.registry.${builtins.currentSystem}'
This project tracks work with bw (beadwork), which persists to git plans, progress, and decisions survive
compaction, session boundaries, and context loss.
ALWAYS run bw prime before starting work. Without it, you're missing workflow context, current state, and repo
hygiene warnings. Work done without priming often conflicts with in-progress changes.
Committing, closing issues, and syncing are part of completing a task not separate actions requiring additional permission.
Issues are tracked with beadwork (bw), a git-native tracker; IDs are tb-XYZ and live on the beadwork branch. PRs are not a triage surface. See docs/agents/issue-tracker.md.
Canonical label vocabulary (needs-triage, needs-info, ready-for-agent, ready-for-human, wontfix), applied via bw label. See docs/agents/triage-labels.md.
Single-context: one CONTEXT.md + docs/adr/ at the repo root. See docs/agents/domain.md.