Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Architecture and Trust Model

vug separates package resolution, artifact delivery and host activation. The client checks a signed package selection against local policy before it changes a profile.

Four roles

  1. Author. Write vug.star in Starlark, a Python-like configuration language. The declaration returns structured data, including a target identity, a Nixpkgs pin and desired resources.
  2. Management CI. Run vug record lock to evaluate the selected Nixpkgs attributes into output paths, inspect the reference graph and publish a signed lock. The signing key stays with the trusted management runner.
  3. Binary cache. A substituter is a cache that supplies prebuilt Nix objects. A NAR (Nix Archive) is a serialization of a store object, including files, directories or symbolic links. A narinfo is a metadata record that identifies the archive and describes its hash, size, references and available signatures. An Ed25519 signature is made with a private signing key and checked with its public counterpart. Nix caches serve NARs with signed narinfo metadata.
  4. Client. Evaluate the bounded Starlark declaration, check the local host identity and validate the lock against trust.toml. During apply, acquire the exact objects from the store or by substitution and pin them for the generation. User environments, Caches and roots.

The management signature authenticates the selected closure. The cache signatures authenticate its store objects.

Why the client can skip Nix evaluation

Resolving an attribute such as ["hello"] against a Nixpkgs revision computes a concrete store path for each requested output. CI records those paths plus their transitive references, so a client already knows the entire graph and the expected hashes. On Linux with the vug-owned backend, it can materialize the closure without an installed Nix daemon. With the nix-daemon backend, the client asks the existing daemon to substitute fixed store paths with builds disabled. Both still evaluate the small Starlark declaration to verify that it matches the lock. Lock validation, Client store acquisition.

LocationWhat it records
vug.lockDeclaration and lock digests, lock key name and signature, evaluation inputs, resolved package outputs, fixed runtime tools, resolved FHS mappings when present, and the closure’s paths, NAR hashes and sizes, references, cache hints and signatures.
${XDG_CONFIG_HOME:-~/.config}/vug/trust.tomlLocally accepted lock signing keys, allowed HTTPS caches and their keys, per-profile cache permissions, protected units, reserved paths and optional store limits and credential file paths.
${XDG_STATE_HOME:-~/.local/state}/vugActive and retained generations, operation records and journals, and information needed to preserve the store roots and recover an interrupted operation.

A cache hint in the lock is subject to the client’s policy. Similarly, a valid cache signature authenticates a store object while the lock signature binds that object to this declaration and its other inputs. A change to the target identity changes the declaration digest. Editing a lock’s attributes or closure changes the digest covered by its signature. Lock and policy definitions, Operation journal.

Lean 4 verified core

Lean 4 is a programming language and theorem prover. vug’s verified decision core consists of selected pure functions and theorems about them. The build uses leanfran to generate Rust implementations from the Lean definitions. The embedded definitions and proofs live in the LeanRustGen Lean library under lean/LeanRustGen.

  • Version ordering. Lean proves properties of the comparison, including transitivity of the less-than relation and reversal when arguments are swapped.
  • Registry naming. Lean defines the allowed characters and path constructors and proves properties such as absence of slashes in valid names and uniqueness of version paths for valid inputs.
  • Merge decisions. The decision table gives failure priority over incomplete checks. With neither present, a record-only change without an approval requirement can auto-merge. Other changes require approval.

These proofs concern the modeled functions. Cache delivery, signature verification and systemd operation handling have their own Rust implementations. Build entry point, Lean modules, Version model, Naming model, Merge model.