aeroflare

module
v1.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2026 License: GPL-3.0

README

Aeroflare

High-performance OCI-backed Nix binary cache proxy written in Go.

Aeroflare bridges the Nix ecosystem and standard container registries (such as GitHub Container Registry or Docker Hub) to act as a stateless, zero-infrastructure binary substituter.


Key Features

  • Stateless Proxying: Retains zero local binary state. Streams .nar blobs directly from OCI.
  • O(1) Manifest Lookups: Tags artifacts directly with the 32-character Nix store path hash, enabling instantaneous lookups.
  • Interactive Provisioning: A built-in setup wizard for GitHub, GitLab, and Cloudflare Worker deployment.
  • Execution Wrapper: Run builds transparently with the run wrapper (aeroflare run -- nix build).
  • Native OCI Storage: Each package is one OCI image tagged with its store hash — NAR blobs as layers, narinfo as manifest annotations. No separate metadata store.

Quick Start

1. Initialize

Run the interactive onboarding wizard to configure credentials and provision resources:

nix run github:ItzEmoji/aeroflare -- init
3. Build & Cache

Execute a build and automatically push the outputs:

nix run github:ItzEmoji/aeroflare -- run -- nix build .#default --print-out-paths

Note: The --print-out-paths flag is necessary for the run command to know which store paths were built and need to be cached.


Docker

Run the proxy as a container — no Nix or Go toolchain required on the host:

docker run -e AEROFLARE_CACHE=<org>/<cache> -p 8080:8080 ghcr.io/itzemoji/aeroflare-proxy

Full guide, including private-cache credentials and a persistent docker-compose.yml setup: Docker.


GitHub Action

Build your flake outputs and push them to an OCI cache from CI. Nix must already be on the runner — the action does not install it.

One cache, builds listed inline:

jobs:
  cache:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      packages: write
    steps:
      - uses: actions/checkout@v5
      - uses: DeterminateSystems/nix-installer-action@v20
      - uses: ItzEmoji/aeroflare@v1
        with:
          cache: ghcr.io;${{ github.repository_owner }}/nix-cache
          builds: |
            .#default
            .#packages.x86_64-linux.foo

ghcr.io authenticates with the workflow's github.token automatically; any other registry takes a cache-token. By default only store paths missing from https://cache.nixos.org are uploaded, so your cache holds your artifacts rather than a copy of nixpkgs.

Full guide, including advanced config: mode, multiple caches, GitLab CI, generic runners, and binary verification: GitHub Action.


Codebase Directory Map

Everything under pkg/ is public and importable; internal/ is the CLI's own plumbing and cannot be imported from outside the module.

.
├── cmd/                # Binary entry points (aeroflare, aeroflare-ci)
├── pkg/                # Public API — see "Using Aeroflare as a Go library"
│   ├── oci/            # OCI registry transport: layers, pushers, token exchange, retry
│   ├── prepare/        # NAR serialization, hashing, compression, signing, upstream lookup
│   ├── push/           # Push pipeline (prepare -> upload), Reporter-driven
│   ├── proxy/          # Substituter HTTP server, handlers, token management
│   ├── cmd/            # Cobra command tree, one package per command
│   ├── cmdutil/        # Factory + the CLI's config/credential resolution (Viper, env, keyring)
│   └── iostreams/      # stdin/stdout/stderr abstraction
├── internal/           # CLI-only packages, not importable by other modules
│   ├── auth/           # OAuth token flows, device authorization
│   ├── secrets/        # Credentials manager (keyring + plaintext fallback)
│   ├── backend/        # CacheBackend abstraction + native OCI-tag implementation
│   ├── ci/             # `aeroflare-ci` build orchestration
│   ├── run/            # `aeroflare run` build wrapper
│   ├── init/           # Interactive provisioning wizards
│   └── ui/             # Shared terminal UI components
└── docs/               # Docusaurus documentation website

Using Aeroflare as a Go library

Aeroflare's engines are importable, not just runnable. The packages under pkg/ are documented for go doc:

Package What it does
pkg/oci Registry client: token exchange, blobs, manifests
pkg/prepare Nix store path → NAR + narinfo (hashing, compression, signing)
pkg/push The NAR/narinfo → registry upload pipeline
pkg/proxy The Nix substituter HTTP server
$ go doc github.com/itzemoji/aeroflare/pkg/push
$ go doc github.com/itzemoji/aeroflare/pkg/oci ExchangeToken

These packages take their configuration as explicit parameters. They do not read Viper, the environment, or the OS keyring, and they never write to stdout — resolving credentials and rendering progress are the caller's job. pkg/cmdutil holds the CLI's own answers to those questions and is a worked example. Each package's doc.go carries a runnable example.

API stability

The Go API under pkg/ is not covered by this module's semantic version.

Aeroflare is versioned as a command-line tool. A release may change, rename, or remove any exported Go symbol without a major version bump, and the project makes no compatibility promise to importers. If these packages are useful to you, import them — but pin an exact version and expect to make adjustments when you upgrade.


Documentation

For full guides, reference manuals, and architecture explanations, check out the documentation site or browse docs/docs/.

Directories

Path Synopsis
cmd
aeroflare command
Command aeroflare is an OCI-backed Nix binary cache proxy and toolkit.
Command aeroflare is an OCI-backed Nix binary cache proxy and toolkit.
aeroflare-ci command
Command aeroflare-ci is a lightweight, non-interactive CI runner that builds Nix flake installables and pushes them to one or more OCI caches.
Command aeroflare-ci is a lightweight, non-interactive CI runner that builds Nix flake installables and pushes them to one or more OCI caches.
gen_docs command
internal
aerocmd
Package aerocmd is the aeroflare entrypoint: it builds the Factory, runs the root command, and translates the result into a process exit code.
Package aerocmd is the aeroflare entrypoint: it builds the Factory, runs the root command, and translates the result into a process exit code.
auth
Package auth implements GitHub's OAuth device authorization flow (https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps#device-flow) so that aeroflare can obtain a GitHub access token without a client secret or a browser redirect, and resolves credentials for GitHub, GitLab, and generic OCI registries from flags, environment variables, or the secrets manager.
Package auth implements GitHub's OAuth device authorization flow (https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps#device-flow) so that aeroflare can obtain a GitHub access token without a client secret or a browser redirect, and resolves credentials for GitHub, GitLab, and generic OCI registries from flags, environment variables, or the secrets manager.
build
Package build holds version metadata for aeroflare binaries.
Package build holds version metadata for aeroflare binaries.
ci
Package ci implements aeroflare-ci: a lightweight, non-interactive CI runner that builds Nix flake installables and pushes them to one or more OCI caches.
Package ci implements aeroflare-ci: a lightweight, non-interactive CI runner that builds Nix flake installables and pushes them to one or more OCI caches.
run
Package run executes a command through a local Nix proxy substituter and harvests the resulting store paths for caching or pushing.
Package run executes a command through a local Nix proxy substituter and harvests the resulting store paths for caching or pushing.
secrets
Package secrets stores and retrieves credentials (GitHub/GitLab/OCI tokens) using the OS keychain via go-keyring as the primary backend.
Package secrets stores and retrieves credentials (GitHub/GitLab/OCI tokens) using the OS keychain via go-keyring as the primary backend.
secrets/secretstest
Package secretstest provides an in-memory secrets.Manager for tests.
Package secretstest provides an in-memory secrets.Manager for tests.
ui
pkg
cmd/auth
Package auth implements `aeroflare auth` and its subcommands.
Package auth implements `aeroflare auth` and its subcommands.
cmd/auth/get
Package get implements `aeroflare auth get`.
Package get implements `aeroflare auth get`.
cmd/auth/importcmd
Package importcmd implements `aeroflare auth import`.
Package importcmd implements `aeroflare auth import`.
cmd/auth/login
Package login implements `aeroflare auth login`.
Package login implements `aeroflare auth login`.
cmd/auth/remove
Package remove implements `aeroflare auth remove`.
Package remove implements `aeroflare auth remove`.
cmd/auth/set
Package set implements `aeroflare auth set`.
Package set implements `aeroflare auth set`.
cmd/auth/shared
Package shared holds token-resolution and interactive-auth logic used by the auth command and by every other command that needs a credential (init, run, push, blob, proxy, configure).
Package shared holds token-resolution and interactive-auth logic used by the auth command and by every other command that needs a credential (init, run, push, blob, proxy, configure).
cmd/auth/status
Package status implements `aeroflare auth status`.
Package status implements `aeroflare auth status`.
cmd/blob
Package blob implements the `push-blob` and `pull-blob` commands, which push or pull a single blob to/from the OCI registry directly (bypassing the Nix store/push pipeline).
Package blob implements the `push-blob` and `pull-blob` commands, which push or pull a single blob to/from the OCI registry directly (bypassing the Nix store/push pipeline).
cmd/configure
Package configure implements `aeroflare configure`, which interactively configures cache settings and saves them to the OCI config manifest.
Package configure implements `aeroflare configure`, which interactively configures cache settings and saves them to the OCI config manifest.
cmd/init
Package initcmd implements `aeroflare init`, an interactive wizard that provisions Aeroflare infrastructure.
Package initcmd implements `aeroflare init`, an interactive wizard that provisions Aeroflare infrastructure.
cmd/prepare
Package prepare implements `aeroflare prepare`, which generates NAR archives and narinfo files from Nix store paths without pushing them anywhere.
Package prepare implements `aeroflare prepare`, which generates NAR archives and narinfo files from Nix store paths without pushing them anywhere.
cmd/proxy
Package proxy implements `aeroflare proxy`, which starts the cache proxy server.
Package proxy implements `aeroflare proxy`, which starts the cache proxy server.
cmd/push
Package push implements `aeroflare push` and provides the shared flag set and pipeline (Preflight -> DisplaySummary -> RunPush) that `run` reuses so the two commands cannot drift apart.
Package push implements `aeroflare push` and provides the shared flag set and pipeline (Preflight -> DisplaySummary -> RunPush) that `run` reuses so the two commands cannot drift apart.
cmd/root
Package root assembles the aeroflare command tree and owns the config bootstrap: InitConfig locates (or creates) aeroflare.yaml and binds the AEROFLARE_* environment prefix, and NewCmdRoot wires every subcommand onto the root command.
Package root assembles the aeroflare command tree and owns the config bootstrap: InitConfig locates (or creates) aeroflare.yaml and binds the AEROFLARE_* environment prefix, and NewCmdRoot wires every subcommand onto the root command.
cmd/run
Package run implements `aeroflare run`.
Package run implements `aeroflare run`.
cmd/settings
Package settings implements `aeroflare settings`, an interactive terminal UI (using huh) for configuring themes, registry logins, and custom caching URLs.
Package settings implements `aeroflare settings`, an interactive terminal UI (using huh) for configuring themes, registry logins, and custom caching URLs.
cmd/version
Package version implements `aeroflare version`, reporting the build version and date stamped into the binary at link time.
Package version implements `aeroflare version`, reporting the build version and date stamped into the binary at link time.
cmdutil
Package cmdutil holds the Factory, the dependency bundle every aeroflare command is constructed with.
Package cmdutil holds the Factory, the dependency bundle every aeroflare command is constructed with.
cmdutil/cmdutiltest
Package cmdutiltest builds Factories for tests.
Package cmdutiltest builds Factories for tests.
iostreams
Package iostreams carries the input and output streams a command reads and writes, so commands never reach for os.Stdout directly and can be tested by swapping in buffers.
Package iostreams carries the input and output streams a command reads and writes, so commands never reach for os.Stdout directly and can be tested by swapping in buffers.
oci
Package oci stores and retrieves Nix binary cache artifacts in an OCI registry.
Package oci stores and retrieves Nix binary cache artifacts in an OCI registry.
prepare/cache
Package cache queries upstream Nix binary caches, such as https://cache.nixos.org.
Package cache queries upstream Nix binary caches, such as https://cache.nixos.org.
prepare/compress
Package compress wraps the compression algorithms a Nix binary cache may use for NAR files: zstd, xz, gzip, or none.
Package compress wraps the compression algorithms a Nix binary cache may use for NAR files: zstd, xz, gzip, or none.
prepare/hash
Package hash implements the hashing and base32 encoding Nix uses for store paths and NAR digests.
Package hash implements the hashing and base32 encoding Nix uses for store paths and NAR digests.
prepare/narinfo
Package narinfo parses and renders the .narinfo metadata files a Nix binary cache serves.
Package narinfo parses and renders the .narinfo metadata files a Nix binary cache serves.
prepare/prepare
Package prepare turns Nix store paths into the artifacts a binary cache serves: a compressed NAR plus its narinfo metadata.
Package prepare turns Nix store paths into the artifacts a binary cache serves: a compressed NAR plus its narinfo metadata.
prepare/signing
Package signing creates and verifies the ed25519 signatures Nix uses to authenticate binary cache entries.
Package signing creates and verifies the ed25519 signatures Nix uses to authenticate binary cache entries.
prepare/store
Package store reads the local Nix store.
Package store reads the local Nix store.
proxy
Package proxy serves a Nix binary cache backed by an OCI registry.
Package proxy serves a Nix binary cache backed by an OCI registry.
push
Package push uploads Nix store paths to an OCI registry as binary cache artifacts.
Package push uploads Nix store paths to an OCI registry as binary cache artifacts.
Command build provides build tasks for aeroflare, mirroring the pattern used by github/cli's scripts/build.go: a small Go program that computes version/date metadata and invokes `go build` with the right ldflags, so the same logic runs locally and in CI.
Command build provides build tasks for aeroflare, mirroring the pattern used by github/cli's scripts/build.go: a small Go program that computes version/date metadata and invokes `go build` with the right ldflags, so the same logic runs locally and in CI.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL