Skip to content

fix(nix): disable the self-updater in the flake build - #54638

Closed
fabiob wants to merge 1 commit into
anomalyco:devfrom
fabiob:fix/nix-disable-autoupdate
Closed

fabiob wants to merge 1 commit into
anomalyco:devfrom
fabiob:fix/nix-disable-autoupdate

Conversation

@fabiob

@fabiob fabiob commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Supersedes #54021 — branch rebased onto dev after the v2 promotion (Oct 10).

Issue for this PR

Closes #54022

Type of change

  • Bug fix

What does this PR do?

opencode installed via this repo's flake lives in the read-only Nix store, but the TUI still offers the in-app update. Accepting it starts the self-updater, which cannot replace the binary, and the session stops responding until its processes are killed.

This sets OPENCODE_DISABLE_AUTOUPDATE=1 in the flake's existing wrapProgram call, so the flake's opencode skips the updater entirely — the env var the updater already supports. Nix users update through nix.

How did you verify your code works?

Built nix build .#opencode on NixOS (x86_64-linux), confirmed the installed wrapper sets the variable before exec, and ran opencode serve and --version — both work, with no update-check activity in the logs.

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Related: #52122

The flake-built binary lives in the read-only Nix store, so the
self-updater can never apply an update — and when the TUI offers one,
the attempt fails and can leave a running session in a bad state
(observed on NixOS: the update flow started and the session stopped
responding until its processes were killed).

Set OPENCODE_DISABLE_AUTOUPDATE=1 in the existing wrapper so the
flake's opencode skips the updater entirely; users update through
nix. The env var is already supported by the updater.
@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@fabiob

fabiob commented Oct 11, 2026

Copy link
Copy Markdown
Contributor Author

Renaming the head branch to nix-disable-autoupdate to comply with the project's branch naming convention (no slashes/type prefixes). Continuing in #54641.

@fabiob fabiob closed this Oct 11, 2026
@fabiob
fabiob deleted the fix/nix-disable-autoupdate branch October 11, 2026 22:42

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This fixes what #54022 reports for flake installs. With OPENCODE_DISABLE_AUTOUPDATE=1 set, the automatic update check is skipped, so the home-screen /update to install vX notice and its prompt no longer appear.

There's no Nix in my sandbox, so I simulated the flake install: the released 2.0.25 binary in a read-only /nix/store-style folder, behind a wrapper that sets the variable and runs it, like wrapProgram does. Without the variable, the home screen offered v2.0.26. With it, the notice was gone. I couldn't run nix build.

Public API: unchanged. This only sets an existing environment variable in the Nix package.

One gap: the manual /update command still offers the update. In my run with the variable set, /update opened "Update available" with an Update button, and accepting it still failed with Installation method not found. The variable is only read by the automatic check (inspect() in packages/cli/src/services/updater.ts); check() and apply(), which /update uses, ignore it. Nix users who run /update still reach the path that failed for you. To fully cover it, check() would need to honour the variable (or report unavailable when no installation method is found, as the issue suggests). That would be a change in the CLI rather than in the flake, so it could also be a follow-up.

Separately, the new comment is inline below.

Related: #52122

Before

After

Screenshot

Comment thread nix/opencode.nix
install -Dm755 dist/cli-*/bin/opencode $out/bin/opencode

# OpenTUI dlopens Wayland for clipboard images.
# A Nix store install cannot self-update: the store is read-only, and an

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This block sits between # OpenTUI dlopens Wayland for clipboard images. and the LD_LIBRARY_PATH line that comment explains, so the Wayland comment now reads as if it explains this one. For a one-line fix the comment isn't needed; it can be dropped (along with the unrelated versionCheckKeepEnvironment reformat) so the change stays minimal.

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.

Updater offers in-app updates for Nix store installs; taking it breaks the running session

1 participant