Skip to content

Nix desktop arms the production auto-updater #52122

Open

Description

@jerome-benoit

Description

A desktop installed from Nix has the production auto-updater enabled, so it can be offered a released binary over the package its distribution installed.

The Nix build sets OPENCODE_CHANNEL=prod, and the gate is app.isPackaged && CHANNEL !== "dev" (packages/desktop/src/main/constants.ts). The packaged app-update.yml points at the public feed:

provider: generic
url: https://opencode.ai/update/api/latest/desktop/opencode/
channel: latest

This predates the nix packaging rewrite; it was not visible while the Nix desktop build did not complete.

Plugins

None

OpenCode version

Affected source: 2.0.19+c977050030

Steps to reproduce

  1. nix build .#packages.x86_64-linux.opencode-desktop (needs the nix/hashes.json override from node_modules FOD hash is calibrated against one bun version — breaks with any other #49063).
  2. cat $out/opt/opencode-desktop/resources/app-update.yml → the public update URL above.
  3. nix derivation show $(nix eval --raw .#packages.x86_64-linux.opencode-desktop.drvPath) → OPENCODE_CHANNEL = 'prod'.

Screenshot and/or share link

Not applicable; outputs included above.

Operating System

Linux x86_64, nixpkgs 26.11, nix 2.34.8

Terminal

Not applicable, the reproduction is command line only.

Activity

  1. github-actions commented on Sep 29, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • Please use the Bug Report template and include its required Description field with the issue details. The current body uses “What happens” instead, so the required Description field is missing.

    Please edit this issue to address the above within 2 hours, or it will be automatically closed.

    If you believe this was flagged incorrectly, please let a maintainer know.

  2. changed the title [-]nix: the Nix desktop arms the production auto-updater[/-] [+]Nix desktop arms the production auto-updater[/+] on Sep 29, 2026
  3. github-actions commented on Sep 29, 2026

    @github-actions
    Contributor

    Thanks for updating the issue. It still needs to use the Bug Report template's required Description field. The issue has useful reproduction steps and system details, but the current body has no Description field. Please add the details under that required field.

  4. github-actions commented on Sep 29, 2026

    @github-actions
    Contributor

    Thanks for updating the issue. The required Description field and useful reproduction details are now included.

  5. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    Thanks for the detailed report. I checked this against the source, not with a real nix build (no Nix in this sandbox), and it holds on the latest dev (86ce19d96), with one difference from your setup.

    • Channel: in upstream nix/, OPENCODE_CHANNEL = "prod" is set only in the CLI derivation (nix/opencode.nix). nix/desktop.nix doesn't inherit or set it, so the upstream desktop build falls back to the dev channel, and its app-update.yml points at https://opencode.ai/update/api/dev/desktop/opencode/. With OPENCODE_CHANNEL=prod, as in your derivation, it gives exactly the public latest feed you quoted. c977050030 isn't in upstream dev history, so your tree may differ there.
    • Gate on v2.0.19: it was app.isPackaged && CHANNEL !== "dev", so an upstream Nix desktop on the dev channel had the updater off.
    • Gate on current dev: since refactor(app): move GUI features into built-in extensions #52369 it is just build.packaged (packages/gui-plugins/src/updater/main.ts). The Nix wrapper sets ELECTRON_FORCE_IS_PACKAGED=1, so a Nix-built desktop now checks for updates at startup and every 10 minutes, whichever channel it was built with.

    The script below prints the feed the desktop config resolves with and without OPENCODE_CHANNEL=prod, and shows the updater gate.

    Related:

    Reproduction script (nix-channel.sh)
    #!/usr/bin/env bash
    # Evaluates which channel/update feed the desktop build resolves under the environment
    # nix/desktop.nix provides (it does not set OPENCODE_CHANNEL), versus OPENCODE_CHANNEL=prod.
    set -euo pipefail
    REPO=${REPO:-/workspace/repo}
    cd "$REPO/packages/desktop"
    echo "nix/desktop.nix mentions OPENCODE_CHANNEL: $(grep -c OPENCODE_CHANNEL "$REPO/nix/desktop.nix" || true)"
    echo "nix/opencode.nix (CLI derivation): $(grep OPENCODE_CHANNEL "$REPO/nix/opencode.nix")"
    for ch in "" prod; do
      echo "--- OPENCODE_CHANNEL='${ch}'"
      env ${ch:+OPENCODE_CHANNEL=$ch} bun -e 'const { getConfig } = await import("./electron-builder.config.ts"); const c = getConfig(); console.log(JSON.stringify({ appId: c.appId, publish: c.publish }))'
    done
    echo "--- updater gate:"
    grep -n "const enabled" "$REPO/packages/gui-plugins/src/updater/main.ts" || grep -n UPDATER_ENABLED "$REPO/packages/desktop/src/main/constants.ts"

    Run it: bash nix-channel.sh

  6. carterworks commented on Oct 29, 2026

    @carterworks
    Contributor

    Also affects MacOS, such as is done by numtide/llm-agents.nix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions