Thanks to visit codestin.com
Credit goes to github.com

Skip to content

🤖 fix: stamp real version in Nix flake builds - #3686

Merged
ethanndickson merged 2 commits into
mainfrom
version-display-p77c
Jul 9, 2026
Merged

🤖 fix: stamp real version in Nix flake builds#3686
ethanndickson merged 2 commits into
mainfrom
version-display-p77c

Conversation

@ethanndickson

Copy link
Copy Markdown
Member

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

Nix strips .git from the build sandbox, so generate-version.sh's git
describe/rev-parse fell back to "unknown" and the title bar showed
"unknown". Feed the revision the flake already resolves (self.rev /
dirtyRev) into the build via RELEASE_TAG + a new GIT_COMMIT override.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f7a292e2f4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/generate-version.sh Outdated
@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

Plain GIT_COMMIT is exported ambiently by some CI systems (Jenkins),
which could pair a stale commit with HEAD's describe.
@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

Addressed the GIT_COMMIT ambient-env concern by namespacing the override as MUX_GIT_COMMIT (6945d18).

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 6945d18a21

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ethanndickson
ethanndickson added this pull request to the merge queue Jul 9, 2026
Merged via the queue into main with commit 9cebf03 Jul 9, 2026
22 checks passed
@ethanndickson
ethanndickson deleted the version-display-p77c branch July 9, 2026 08:53
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