Skip to content

v0.27.2-nightly.3

@ethanndickson ethanndickson tagged this 09 Jul 08:43
## Summary

Nix flake builds displayed `unknown` as the app version (top-left title
bar and About dialog) because the version stamp could never be computed
inside the build sandbox. This feeds the revision the flake already
knows into the build so the version is stamped correctly.

## Background

The version shown in the UI comes from `src/version.ts`, which is
generated at build time by `scripts/generate-version.sh` using `git
describe --tags --always --dirty` and `git rev-parse --short HEAD`. Both
fall back to the literal string `"unknown"` when the git commands fail.

Nix copies only git-tracked files into the build sandbox and strips the
`.git` directory, so those git commands have no repository to read and
both fall back to `"unknown"`. Having `git` in `nativeBuildInputs` only
provides the binary, not the repo metadata, so it doesn't help.

Ironically the flake already computes the revision (`version = self.rev
or self.dirtyRev or "dev"`) but never passed it into the build, so that
value was discarded before the script ran.

## Implementation

The version script already supports a `RELEASE_TAG` override that skips
the git calls and sets `git_describe` directly (used by CI release
builds). The flake's `buildPhase` now exports that revision:

- `RELEASE_TAG="${version}"` sets `git_describe`.
- `GIT_COMMIT="${builtins.substring 0 12 version}"` sets the commit
field via a new override.

`generate-version.sh` now honors an incoming `GIT_COMMIT` env var,
keeping the git-based default when it's unset so non-Nix builds are
unchanged.

## Risks

Low. The change only affects build-time version stamping. Non-Nix builds
keep their existing git-based behavior (the `GIT_COMMIT` default is
unchanged when the env var is unset), and the script's `unknown`
fallback still applies when neither git nor overrides are available.

One cosmetic note: Nix dev builds now log `Release build: using
RELEASE_TAG=...` in build output, which is slightly misleading but
harmless.

---

_Generated with `mux` • Model: `anthropic:claude-opus-4-8` • Thinking:
`xhigh` • Cost: `$1.11`_

<!-- mux-attribution: model=anthropic:claude-opus-4-8 thinking=xhigh
costs=1.11 -->
Assets 2
Loading