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

Installation, Trust Policy, and Host Checks

Install vug, select a store backend and give the client a local trust policy. Then use vug store doctor to inspect the prerequisites for your profile.

Install the CLI

On a host with the Nix CLI and flakes enabled, build the pinned revision or run it directly:

nix build github:conao3/rust-vug/136aad68d179307d0f7d49f42506a38f337b80d5
./result/bin/vug --version
nix run github:conao3/rust-vug/136aad68d179307d0f7d49f42506a38f337b80d5 -- --version

On a host without Nix, obtain the static Linux x86-64 release archive vug-0.2.29-x86_64-linux-musl.tar.gz. musl is the C library used for this statically linked build. Extract vug and vug-bwrap into the same directory. The latter is the bundled bubblewrap executable, which vug uses to create isolated execution environments. Pinned release build, v0.2.29 release.

install -d -m 0700 "$HOME/.local/lib/vug"
tar -xzf vug-0.2.29-x86_64-linux-musl.tar.gz -C "$HOME/.local/lib/vug"
export PATH="$HOME/.local/lib/vug:$PATH"
vug --version

The apply worker checks the canonical executable path. It must be a regular file with group and other write permissions disabled. A Nix store executable qualifies through its store path. For the standalone release, the executable and its ancestor directories must belong to root or the executing user. Ancestor directories with group or other write permissions are refused unless they carry the sticky bit, which restricts deletion and renaming of other users’ entries. Choose a directory whose contents other users cannot replace. Worker executable check.

Select the store backend

Backend in profile.store_backendStorage and trust
nix-daemonUses the shared local Nix daemon for substitution, subject to its existing trust restrictions. vug disables local builds and registers generation roots with the daemon.
vug-ownedInstalls verified objects under ${XDG_DATA_HOME:-~/.local/share}/vug/nix-store. vug exposes these objects at their logical /nix/store paths when it runs a profile command. This backend can use private caches.

A garbage collection root keeps a store object and its references reachable, so they survive cleanup. The private store is bound to its state directory on first use. If you select a different XDG_STATE_HOME, choose a separate XDG_DATA_HOME too. vug refuses to prune a private store if it cannot verify the state-directory binding. Store policy, Store binding.

Write the client trust policy

Create ${XDG_CONFIG_HOME:-~/.config}/vug/trust.toml as a regular file owned by the account running vug. Mode 0600 works. Replace the demo value under lock_keys with the public part of the CI lock-signing key, expressed as base64 without its key name. The official cache key below is public.

schema_version = 1
protected_units = ["tmux-server.service"]
reserved_paths = [".config/externally-managed"]

# Uncomment only if your profile uses encrypted systemd credentials.
# sops_age_key_file = "/home/example-user/.config/vug/age-keys.txt"

[lock_keys]
demo = "<replace with the public key from CI>"

[substituters."https://cache.nixos.org"]
profiles = ["demo"]

# Nix signs metadata at this origin with the key below.
[substituters."https://cache.nixos.org".keys]
"cache.nixos.org-1" = "6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
FieldMeaning
schema_versionRequired integer, currently 1.
lock_keysRequired, nonempty table of named Ed25519 public keys authorized to sign locks.
protected_units, reserved_pathsOptional lists. The former protects additional systemd unit names. The latter blocks management of overlapping home-relative paths.
sops_age_key_fileOptional absolute path to a private, user-owned age identity file. age is a file-encryption tool and format. SOPS is a tool for encrypting and decrypting structured files such as YAML and can use age identities.
substitutersRequired table keyed by normalized HTTPS cache URLs, without a trailing slash. Each entry requires nonempty profiles and keys. The official Nix cache requires exactly the official key and must be public.
substituters.<origin>.private, authorization_fileOptional. private defaults to false. Private origins are usable only with vug-owned. A private origin can read an Authorization header value from a private, user-owned file.
limitsOptional table. Override positive bounds with paths, narinfo_bytes, file_bytes, nar_bytes, total_file_bytes or total_nar_bytes. The first two are capped at 65,536 paths and 1 MiB respectively.

The signed cache client rejects redirects. For a locked object, alternate permitted origins must have the same public or private designation as its preferred origin. Trust parser and origin selection, Signed cache client.

Check the host

A systemd user manager is the service manager for a particular user. Linger=yes is the logind setting that keeps that manager running after the user’s final session ends. Apply and recovery require both. Check the currently logged-in account on the test host:

loginctl show-user --property=Linger --value -- "$(id -un)"
systemctl --user show --property=UnitPath --value
vug store doctor --file vug.star

If the first check reports no, enable lingering on the test host with loginctl enable-linger "$(id -un)" under the account or through its administrator, according to the host’s policy. store doctor checks the host and UID, combined declaration/lock/trust validity, the store, generation roots, lingering and the FHS namespace probe. Each check has its own passed, failed or unknown result. A completed report exits 0 even when a check fails. With no declaration in an isolated directory, signature_policy was failed and store and gc_roots were unknown. On a daemon profile, the store check expects the caller to be untrusted according to the daemon. Doctor implementation, Host checks.

Output and exit status

--output json|text|table is global. JSON is the default and is the format to save for apply plans. --debug prints parsed inputs to standard error. Use --no-debug after it to disable that output.

$ vug --version
vug 0.2.29
$ vug version compare-versions --left 1.9 --right 1.10
{
  "Ordering": "Less"
}
$ vug --output text version compare-versions --left 1.9 --right 1.10
Less
$ vug --output table version compare-versions --left 1.9 --right 1.10
Ordering
Less

The comparator treats numeric components as numbers, so 9 sorts before 10. Reversing the inputs gives Greater, and passing 1.10 on both sides gives Equal. The comparison itself succeeds in all three cases.

ExitMeaning
0Success, help or top-level version output. A diagnostic report can contain failed checks.
252Invalid CLI syntax, such as a missing required flag.
254Definite refusal, such as invalid input, an ownership conflict, changed preconditions or a confirmed cache miss.
255An operational or unresolved failure, such as an I/O error, a systemd job failure or an inconclusive cache query.

The table describes the CLI and environment commands discussed here. Commands that launch a program can propagate its exit status. CLI parser and output, Exit constants, Environment failures.