Publishing a module catalog
Host an ordered, cacheable registry.v1.json index for public or organization modules.
The official registry hosts two unrelated formats: registry.json maps Nix short names to flakes, while registry.v1.json lists installable Stackpanel modules. Publish the latter as ordinary JSON over HTTPS. It requires no database or Stackpanel server. A future marketplace can serve the same catalog.
Catalog contract
The document has schemaVersion: 1 and a modules array. Each listing contains its identity (id, slug), display metadata (name, description, icon, category, author, tier), latestVersion, versions, features, uiSlots, and documentation links (homepage, readmeUrl). tier is official, verified, or community; it conveys provenance, not additional permissions.
Each version describes a real module flake: version, flakeUrl, ref or rev, followsNixpkgs, the flakePath output (normally stackpanelModules.default), and any additional flakeInputs required by the consumer. Use a unique slug that is a valid Nix input name. Publish immutable tags or revisions for released versions, retain older versions, and point latestVersion at a listed version. The JSON Schema and a complete catalog live beside the official index.
- Put a module flake, README, and any UI build in a repository. Validate the module with Stackpanel's exported SDK and run a pure consumer
nix flake check. - Make the flake reachable at its published ref before listing it. Check the
?dir=URL if the repository contains several modules. - Add the listing and version to the catalog. Validate the JSON and ensure the README is reachable. Serve an
ETagso unchanged indexes do not need to be downloaded again.
Choosing sources
# .stack/config.nix
{
registries = [ "https://modules.example.org/registry.v1.json" ];
}Project sources are searched first, followed by sources in the user's ~/.config/stackpanel/config.yaml (registries, an ordered list of URLs). With neither configured, the agent uses the official index. The first source to list an ID wins. To use both a private and the official index, list both. For a private index, set registryHeaders in the user file: the key is its exact index URL, and the value is a map of HTTP header names to values. Never put registry credentials in .stack/config.nix, locked URLs, or catalog entries.
Offline behavior
The agent keeps a TTL and ETag cache under the user's cache directory and ships a snapshot of the official catalog. Reading a cached listing does not guarantee its flake sources or binary dependencies are in the Nix store. An install still fails if Nix cannot lock the requested inputs. A broken private registry must not silently resolve its module ID to an unrelated sample.