# Verifying a release Every Ianitor release on Gitea (`vX.Y.Z`) carries `SHA256SUMS` and `SHA256SUMS.minisig`, signed through Custos by the `domi-release` key, and among the files that `SHA256SUMS` lists, `ianitor-nix.json`: the commit the build was made from and the NAR hash of every Nix output (`.#ianitor`, the two binaries; `.#ianitor-web`, the built UI). Ianitor ships no binary download: you build that commit yourself (or your server does, through the NixOS module) and check that you got exactly the bytes the release vouches for. What is checked, and what is not yet: `scripts/nix-pin.sh` builds each output, then rebuilds the output derivation itself once more (`nix build --rebuild`) and refuses to pin it if the two differ; the dependencies come from the binary cache and are not rebuilt. The `verify-nix` pipeline does the same on the NixOS runner for every tag. **None of this has run yet:** the first pin needs a Linux machine with Nix, and the development machine has had none since phase 4 began, so no release so far carries a pin and nothing here is shown reproducible across machines until two independent builds have matched. ## 1. The signature The `domi-release` public key, key id `ABD87B469ADF4BE4` (also in [domi-release.pub](domi-release.pub)): ```text untrusted comment: minisign public key ABD87B469ADF4BE4 RWTkS9+aRnvYq1si0VvyJFeEJf7oQ3Dsadl0/fI64nuVIaz286PGiyPe ``` Take it from a source you trust more than the release page itself (Custos → *Signing keys* → *Copy minisign.pub*, or a clone of this repository you already had). Then, in a folder with the release's files: ```sh minisign -Vm SHA256SUMS -p domi-release.pub # "Signature and comment signature verified" sha256sum -c --ignore-missing SHA256SUMS # every downloaded file: OK ``` (`nix shell nixpkgs#minisign` if you have no minisign. Custos signs prehashed; minisign 0.10 and later verify it.) ## 2. The build `ianitor-nix.json` names the commit the hashes were built from (`commit`; the tag's own commit, `taggedCommit`, differs from it at most by the pin file), the nixpkgs revision of its flake.lock, and the hashes: ```json { "version": "1.0.0", "commit": "<40 hex>", "taggedCommit": "<40 hex>", "nixpkgs": "<40 hex>", "system": "x86_64-linux", "outputs": { "ianitor": { "storePath": "/nix/store/…-ianitor-1.0.0", "narHash": "sha256-…" }, … } } ``` Build that commit and compare (Linux with Nix and flakes; nothing from Ianitor's own caches is needed): ```sh c=$(jq -r .commit ianitor-nix.json) for a in ianitor ianitor-web; do p=$(nix build "git+https://gitea.marek-novak.cz/mnovak/Ianitor.git?rev=$c#$a" --no-link --print-out-paths) got=$(nix path-info --json "$p" | jq -r 'if type == "array" then .[0].narHash else .[].narHash end') want=$(jq -r ".outputs[\"$a\"].narHash" ianitor-nix.json) [ "$got" = "$want" ] && echo "$a: $got matches" || echo "$a: MISMATCH (got $got, release says $want)" done ``` The store path matches too (it depends only on the derivation, so it tells you the inputs were the same); the NAR hash is the content. `nix build --rebuild` builds once more locally and fails if your own two builds differ. On a server that uses the NixOS module, the running build is `services.ianitor.package`, normally `ianitor.packages.x86_64-linux.ianitor` from the flake input pinned in the server's `flake.lock`: if that input's `rev` is the release's commit, `nix path-info --json $(readlink -f /run/current-system/sw/bin/ianitor-edge | sed 's#/bin/.*##')` gives the same NAR hash. ## What this does and does not prove - **Proves:** the release's notes, screenshots and pin are the ones Mark approved and Custos signed; the code at the pinned commit builds to exactly the pinned bytes, on any machine with the same nixpkgs (the flake.lock is part of the commit). - **Does not prove:** that the code is good (that is the five test layers' job, ROADMAP §5), nor anything about the Nix binary cache you build with: a substituted dependency is trusted as Nix trusts it. `nix build --rebuild` and `--option substitute false` narrow that, at the cost of building everything. ## For Mark: making the pin before a tag On a Linux machine with Nix, at a clean commit, the last one before the tag: ```sh scripts/nix-pin.sh # builds, rebuilds the outputs, writes .fabrica/nix/pin.json git add .fabrica/nix/pin.json && git commit -m "[repo] Release: the Nix pin of X.Y.Z" git tag vX.Y.Z # on that commit: it differs from the pinned one only by the pin ``` The pin records its commit and that commit's source tree (every tracked file but the pin itself). The `release` pipeline's `pin` step (`scripts/release-pin.mjs`) refuses a missing pin, a pin of another version, and a pin whose source tree is not the tagged commit's: so "pin at A, fixes land at B, tag B" stops the release before anything is published, and the pin has to be made again at B. That check is the gate: Fabrica's pipelines cannot depend on each other, so `publish` cannot wait for `verify-nix`, which runs on the same tag as an independent second build.