Crate nixfleet_release

Crate nixfleet_release 

Source
Expand description

Producer for releases/fleet.resolved.json and signed sidecars. Pipeline: enumerate hosts -> build -> push -> eval -> inject closureHashes -> stamp meta -> canonicalize -> sign -> smoke-verify -> atomic write -> optional git commit/push. Hook contract lives at the binary surface.

Modulesยง

git ๐Ÿ”’
Git plumbing - shells out to git, never embeds a library.
sign ๐Ÿ”’
Sign-hook + smoke-verify + atomic release-dir write.

Structsยง

GitPushTarget
ReleaseConfig
CLI-assembled config consumed by run.

Enumsยง

HostKind
Which *Configurations attrset a host lives in.
HostsSpec
Hosts to release. Resolved against the consumerโ€™s flake at runtime.
RunOutcome

Functionsยง

build_hosts ๐Ÿ”’
Sequential build. No pin or pin.commit == current_commit -> local build path; non-current commit -> flake-ref build via <pin_source_url>?rev=<commit>. Cross-platform builds rely on the operatorโ€™s nix.buildMachines. Failures abort before any push.
build_local ๐Ÿ”’
build_pinned ๐Ÿ”’
Build via flake-ref at a different commit. The url?rev=<commit> form lets Nix handle checkout + caching; we donโ€™t manage a worktree ourselves.
canonicalize_resolved
closure_hash ๐Ÿ”’
enumerate_hosts ๐Ÿ”’
(host, kind) pairs. NixOS sorted, then Darwin sorted; Explicit preserves caller order. Missing attrsets are empty, not errors.
eval_bootstrap_nonces ๐Ÿ”’
eval_fleet_resolved ๐Ÿ”’
eval_revocations ๐Ÿ”’
filter_expired_pins
Drop expired pins (past expires_at); affected hosts fall back to the current-commit build path. Pins with no expires_at always remain.
inject_closure_hashes
Sets hosts[h].closureHash. Unknown hosts in hashes are silently skipped.
interpret_build_output ๐Ÿ”’
list_attr_optional ๐Ÿ”’
Enumerate attribute names; missing attrset -> empty. โ€œMissing attributeโ€ matches a small set of stable nix-eval phrasings.
load_existing_signed_at_if_unchanged ๐Ÿ”’
Returns existing meta.signedAt when on-disk closure hashes match.
pin_target_commit ๐Ÿ”’
Some(commit) iff the host has a pin AND pin.commit โ‰  current_commit. Same-commit pins return None so the local build path handles them.
prune_expired_bootstrap_nonces ๐Ÿ”’
Strip entries with expires_at < signed_at. Run at sign time so the signed artifact only contains the operational set; fleet.nix can keep historical entries as an audit log.
push_one ๐Ÿ”’
render_commit_message
run
sha256_hex ๐Ÿ”’
stamp_meta
validate_config ๐Ÿ”’
validate_pin_source_url ๐Ÿ”’
Errors when any host has a non-current-commit pin but --pin-source-url is unset. Run AFTER filter_expired_pins so expired pins arenโ€™t counted.