Skip to content

feat: Task 107 -- build version embedding (cargo, CI, Nix)#350

Merged
fredclausen merged 2 commits into
mainfrom
task-107/build-version-embedding
Jun 11, 2026
Merged

feat: Task 107 -- build version embedding (cargo, CI, Nix)#350
fredclausen merged 2 commits into
mainfrom
task-107/build-version-embedding

Conversation

@fredclausen

Copy link
Copy Markdown
Member

Task 107 — Build Version Embedding (v0.9.0)

Closes the Build unknown / fastfetch (unknown) version gaps (PLANNING #7, #8).

Root cause

The About modal and TERM_PROGRAM_VERSION (what fastfetch reads) both surface
VERGEN_GIT_DESCRIBE. The vergen + git describe infrastructure already
existed; the bug was that the describe value resolved to "unknown" on three
independent build paths
, each for a different reason.

Fixes

  • 107.1 — cargo. build.rs had only rerun-if-changed=build.rs, no trigger
    tied to git state, so the describe value cached and went stale (could stick at
    "unknown"). Adds rerun-if-changed for HEAD, packed-refs, and refs,
    resolved via git rev-parse --git-path (correct in worktrees/submodules).
  • 107.2 — CI distributed binaries. deploy.yaml's four build-job checkouts
    used a shallow, tagless clone, so git describe --tags failed. Adds
    fetch-depth: 0 + fetch-tags: true (mirroring the already-correct
    nightly.yml). The release job downloads artifacts only and needs no change.
  • 107.3 — Nix flake (added at activation). cleanSource strips .git and
    the build sandbox is git-less, so the in-build git describe can never
    succeed — and this is the NixOS install path. build.rs now honours a pre-set
    VERGEN_GIT_DESCRIBE env var verbatim (git shell-out remains the fallback);
    flake.nix supplies it from self.shortRev or self.dirtyShortRev or "nix".

Also bumps the workspace version to 0.9.0-beta.6.

Verification

  • cargo clippy --all-targets --all-features -- -D warnings — clean
  • cargo test --all — all pass
  • cargo machete — clean
  • cargo fmt --all -- --check — clean
  • nixfmt / statix check / deadnix --fail on flake.nix — clean
  • nix build .#freminal — wrapped binary embeds
    Build v0.9.0-beta.6-<rev>-dirty and
    TERM_PROGRAM_VERSION = "0.9.0-beta.6 (v0.9.0-beta.6-<rev>-dirty)"; no (unknown)
  • Override layer confirmed both ways: env var set → honoured verbatim, git
    skipped; env var absent → git fallback

Plan: Documents/PLAN_VERSION_090.md (Task 107, marked Complete).

The About modal showed 'Build unknown' and CI-distributed builds reported
'(unknown)' to fastfetch. Root cause across all surfaces: VERGEN_GIT_DESCRIBE
resolving to "unknown". Three independent build paths each produced it:

- 107.1 cargo: build.rs had no rerun trigger tied to git state, so the
  git-describe value cached and went stale. Add rerun-if-changed for HEAD,
  packed-refs, and refs (resolved via git rev-parse --git-path, worktree-safe).
- 107.2 CI: deploy.yaml build checkouts used a shallow, tagless clone, so
  git describe --tags failed. Add fetch-depth: 0 + fetch-tags: true to all
  four build jobs (release job needs no checkout).
- 107.3 Nix: cleanSource strips .git and the sandbox is git-less. build.rs
  now honours a pre-set VERGEN_GIT_DESCRIBE verbatim (git fallback otherwise);
  flake.nix supplies it from self.shortRev/dirtyShortRev.
@fredclausen fredclausen enabled auto-merge June 11, 2026 21:43
@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@fredclausen fredclausen added this pull request to the merge queue Jun 11, 2026
Merged via the queue into main with commit d760f26 Jun 11, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant