Skip to content

Build images

Anastro doesn’t publish prebuilt images yet—you build installers and upgrade releases from the repo with Nix, then sign them locally with your Secure Boot and operator keys. Every node in every cluster runs the exact same image; cluster configuration is applied after boot.

You need Nix with flakes and a Linux builder matching your target architecture (Requirements).

All outputs live under nixosConfigurations.node-<arch>.config.system.build.<output>, where <arch> is x86_64 or aarch64:

Output Produces Use
installer anastro-installer.raw Write to a USB stick to install a node
iso anastro-installer_<version>.iso Boot via BMC virtual media (iDRAC, iLO) or USB stick
release Directory with UKI, store/hash images, and SHA256SUMS Upgrade running nodes
image Installed disk image VMs and tests

Production builds require your public Secure Boot keys (using the wrapper and local signing step below) and enforce [node.boot] secure_boot = true. For an unsigned local VM experiment only, use the explicit development target and set secure_boot = false on that node:

Terminal window
nix build .#nixosConfigurations.dev-node-x86_64.config.system.build.developmentInstaller

Write a raw installer to a USB stick (replace /dev/sdX carefully—this erases the drive):

Terminal window
sudo dd if=result/anastro-installer.raw of=/dev/sdX bs=4M conv=fsync

Configure version, epoch, generation, and keys

Section titled “Configure version, epoch, generation, and keys”

Keep a small node-image.nix wrapper outside the Anastro repo so you can pass your public keys and release numbers cleanly:

node-image.nix
{ arch ? "x86_64", version, generation, epoch ? 1, publicKeys ? null }:
let
anastro = builtins.getFlake "git+file:///path/to/anastro";
node = anastro.nixosConfigurations."node-${arch}".extendModules {
modules = [
{ anastro.image = { inherit version epoch generation; secureBoot.publicKeys = publicKeys; }; }
];
};
in
node.config.system.build

git+file: builds whatever is committed in your local clone. Options under anastro.image:

Option Default Meaning
version "1" Human-readable label shown in UKI names, partition labels, and cluster upgrade --version
epoch 1 Security boundary (1..=256). Raise only when older releases must never unseal /var again
generation required Monotonic release counter within an epoch (>= 1). Increment for every release; never reuse
development false Explicit unsigned dev mode (development* outputs); rejected by release signing and node admission
secureBoot.publicKeys required Path to your public Secure Boot + PCR keys directory (must contain no private keys)
secureBoot.enroll "if-safe" When systemd-boot enrolls keys (off, manual, if-safe, force)
slotSize "3G" Size of each A/B OS slot

Production nodes require Secure Boot. A node’s encrypted /var opens only when UEFI booted a UKI signed by your keys and its signed PCR 11 policy matches the node’s epoch.

Private signing keys never enter Nix or /nix/store: Nix builds an unsigned image using only your public certificates, then a local signer tool signs it outside the Nix store.

  1. Generate your keys (on Linux):

    Terminal window
    nix run .#secureboot-keys -- /secure/anastro-keys

    This creates two directories:

    • public/ holds certificates, signed EFI enrollment variables (PK.auth, KEK.auth, db.auth), and the PCR public key. Safe for Nix to read.
    • private/ holds all private keys. Keep it on your local signing machine—never put it in git, a Nix expression, a remote builder, or a binary cache.
  2. Build the unsigned installer:

    Terminal window
    nix build --impure -f node-image.nix --argstr version 2 --arg generation 2 \
    --arg publicKeys /secure/anastro-keys/public installer -o result-unsigned
  3. Sign locally:

    Terminal window
    signer=$(nix build --no-link --print-out-paths --impure -f node-image.nix \
    --argstr version 2 --arg generation 2 --arg publicKeys /secure/anastro-keys/public secureBootSign)
    "$signer/bin/anastro-secureboot-sign" /secure/anastro-keys/private \
    installer result-unsigned installer-2

    The signed image lands at installer-2/anastro-installer.raw (substitute image, iso, or release for installer as needed). The signer refuses any key path inside /nix/store.

  4. Enroll keys on each node: put the node’s UEFI Secure Boot into setup mode, boot the installer, and choose the enroll entry in systemd-boot’s menu (hold a key during boot to show the menu). VMs in setup mode enroll automatically and reboot.

  5. Keep secure_boot = true: production nodes fail health checks (secure-boot or image-security) unless Secure Boot is active and /var is bound to both PCR 7 and the signed PCR 11 epoch policy.

To build an upgrade release for anastroctl cluster upgrade, pick a version label, allocate the next generation in your current epoch, sign the UKI locally, and then sign the release manifest with an operator key from cluster.operator_keys:

Terminal window
nix build --impure -f node-image.nix --argstr version 2 --arg generation 2 \
--arg publicKeys /secure/anastro-keys/public release -o result-unsigned
signer=$(nix build --no-link --print-out-paths --impure -f node-image.nix \
--argstr version 2 --arg generation 2 --arg publicKeys /secure/anastro-keys/public secureBootSign)
"$signer/bin/anastro-secureboot-sign" /secure/anastro-keys/private \
release result-unsigned release-2
anastroctl cluster release sign release-2 \
--secure-boot-certificate /secure/anastro-keys/public/db.crt \
--pcr-public-key /secure/anastro-keys/public/tpm2-pcr-public-key.pem

release sign parses the UKI and verifies its architecture, Authenticode signature, db.crt, and signed PCR policy before writing SHA256SUMS.sig. Every node repeats those exact checks against the trust material baked into its running image before writing the inactive slot.

Tracking (epoch, generation):

  • Releases are ordered by (epoch, generation), not by the version string. Keep a simple ledger next to your signing keys and increment generation for every release. You can only reset generation back to 1 when you raise epoch.
  • Rotating your operator key does not reset either number: add the new key via cluster apply, confirm every node has it, sign the next generation with the new key, then remove the old key.
  • Format 3 manifests bind generation directly; legacy format 2 manifests are rejected. To migrate older pre-generation nodes, reinstall one replica at a time from a format 3 installer while keeping quorum.

Write the config repo, then install nodes.