The Package Registry: vug-packages
Read and validate the Starlark records that connect package versions to cached Nix outputs or reviewed overlay recipes.
Find a package and its versions
A registry is a package ledger. It uses sharding, or grouping entries into directories by a fixed rule, to keep the package tree easy to traverse. The first two characters of the name form its shard. A one-character name uses that character followed by an underscore, so x lives under packages/x_/x/.
lib/*.star
packages/<shard>/<name>/package.star
packages/<shard>/<name>/versions/<version>.star
packages/<shard>/<name>/patches/*.patch
A package file exports PACKAGE, a version file exports RECORD, and the version value must match the filename stem. Starlark is a deterministic, Python-like language used here to produce data. Records have no general filesystem, environment, network or subprocess access. load() accepts shared modules such as //lib/records.star and relative .star modules within the same package. Symlinks and cross-package imports are rejected. Record format Registry validator
Use the constructors
The shared helpers in lib/records.star build the dictionaries the evaluator expects. This package and version use the pinned ImageMagick record’s values. Constructors
# packages/im/imagemagick/package.star
load("//lib/records.star", "package")
PACKAGE = package(
name = "imagemagick",
license = "Apache-2.0",
sources = ["https://cache.nixos.org/"],
)
# packages/im/imagemagick/versions/7.1.2-35.star
load("//lib/records.star", "nix_output")
RECORD = nix_output(
version = "7.1.2-35",
nixpkgs_rev = "2786a2a72088ecf32aea5b3ec52099e6a7cff78f",
nix_attribute = ["imagemagick"],
)
package() describes the package and its upstream URL prefixes, with an optional homepage. nix_output() points to an existing Nix output. It defaults to outputs = ["out"] and nix_system = "x86_64-linux". The attribute is a list of path components. A nix-output record cannot declare a source, patches or dependencies. Management resolves the outputs at the pinned revision and checks the closure against trusted caches. ImageMagick metadata ImageMagick version
An overlay changes a package in the Nixpkgs package set. Use overlay_record() for a version that needs a fixed source and one of the registry’s recipes. This illustrative demo record assumes its package lists https://example.org/demo/ under sources. Replace the example URL and hash with a real source and its SHA-256 before submitting it.
# packages/de/demo/versions/1.0.star
load("//lib/records.star", "overlay_record")
RECORD = overlay_record(
version = "1.0",
source = {
"url": "https://example.org/demo/demo-1.0.tar.gz",
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
},
visibility = "public",
reason = "upstream-binary",
recipe = "unpack-elf",
overlay = "demo",
nixpkgs_rev = "2786a2a72088ecf32aea5b3ec52099e6a7cff78f",
nix_attribute = ["demo"],
)
Public overlays require visibility = "public" and one of four reasons: fast-lane for an early update, missing for a package absent from the usual selection, patch for a needed fix, or upstream-binary for a binary release. The recipe still has to work at the stated attribute. nix-package overrides a derivation’s version and source and appends declared patches to the existing ones. unpack-elf installs an upstream archive into out and uses Nix’s ELF patching hook to fix binary paths. Declare each patch by file and lowercase hexadecimal sha256. An overlay may also list package IDs in dependencies.build or dependencies.run. Registry rules Gate recipes
Keep private exceptions in a separate access-controlled ledger. Their URLs, revisions, artifacts and closures belong there. Serve their outputs from an authenticated cache such as Attic or private Cachix, and permit that HTTPS substituter and its signing key only for the intended profile in trust.toml. Private origins require vug-owned. Cache authentication controls access to the bytes, while the signing key verifies the cache metadata. Private exceptions Cache trust
Validate and prepare a pull request
From the registry root, run vug record check-tree --root .. The following output is from a clean export of the pinned registry evaluated with vug 0.2.29.
$ vug record check-tree --root .
{
"Errors": [],
"Packages": 99,
"Versions": 99
}
Use vug record check-tree --root . --evaluated to include the Records object keyed by record path. Each value is a normalized object, so defaults such as empty dependency arrays may appear even though the source omitted them. --evaluated requires JSON output. A validation error returns 254 and leaves out Records. This check validates schema, local references and patch bytes. To verify official cache coverage, run the registry’s separate script with a base and a head that describe the checked-out candidate:
VUG=vug python3 .github/scripts/nix-outputs.py record check-closure \
--base origin/master --head HEAD
It checks changed nix-output version records (or all such records when shared helpers change), resolves the pinned outputs and validates the official cache.nixos.org-1 signatures across their closures. Keep each package contribution to one package directory, choose a Nixpkgs revision whose outputs the cache serves, and state the reason for an overlay in the PR. Changes to shared helpers require owner approval. The merge gate also verifies provenance and runs isolated checks. Contribution rules Closure script