Packaging Guidance Request for v1.x #2473

Closed
opened 2026-02-16 17:35:48 -05:00 by yindo · 6 comments
Owner

Originally created by @delafthi on GitHub (Nov 2, 2025).

Originally assigned to: @thdxr on GitHub.

Question

I'm working on packaging OpenCode for Nixpkgs and would appreciate some guidance on how to build v1.x.

I noticed that v1.0 introduced a major architecture change - moving from the Go+bubbletea TUI to OpenTUI (Zig+SolidJS). Looking at the AUR opencode PKGBUILD, it still tries to build the old Go-based TUI that no longer exists in v1.x:

cd packages/tui
CGO_ENABLED=0 go build -ldflags="-s -w -X main.Version=${pkgver}" -o tui cmd/opencode/main.go

Question:

What's the correct build process for v1.x for a single architecture?

I see packages/opencode/scripts/build.ts in the repo, but it appears to build for all architectures. For Nixpkgs, I only need to build for one architecture at a time. Additionally, it looks like build.ts does some custom fetching and adding of opentui packages to the node_modules directory, which probably won't work in the Nix build sandbox.

Is there a simpler build command I can use, or documentation on the manual build steps?

Note: For the time being opencode is packaged with the pre-built binaries.

Originally created by @delafthi on GitHub (Nov 2, 2025). Originally assigned to: @thdxr on GitHub. ### Question I'm working on packaging OpenCode for Nixpkgs and would appreciate some guidance on how to build v1.x. I noticed that v1.0 introduced a major architecture change - moving from the Go+bubbletea TUI to OpenTUI (Zig+SolidJS). Looking at the AUR `opencode` PKGBUILD, it still tries to build the old Go-based TUI that no longer exists in v1.x: ```bash cd packages/tui CGO_ENABLED=0 go build -ldflags="-s -w -X main.Version=${pkgver}" -o tui cmd/opencode/main.go ``` ### Question: **What's the correct build process for v1.x for a single architecture?** I see `packages/opencode/scripts/build.ts` in the repo, but it appears to build for all architectures. For Nixpkgs, I only need to build for one architecture at a time. Additionally, it looks like `build.ts` does some custom fetching and adding of opentui packages to the `node_modules` directory, which probably won't work in the Nix build sandbox. Is there a simpler build command I can use, or documentation on the manual build steps? **Note:** For the time being opencode is packaged with the pre-built binaries.
yindo added the opentui label 2026-02-16 17:35:48 -05:00
yindo closed this issue 2026-02-16 17:35:48 -05:00
Author
Owner

@nicoburniske commented on GitHub (Nov 2, 2025):

I tried using opencode on nixos from nixpkgs/master branch and it fails like this. as if the bun run or whatever entry point command is failing.

so I assume I can't run the pre-built binaries for some reason...

> opencode
Bun is a fast JavaScript runtime, package manager, bundler, and test runner. (1.3.0+b0a6feca5)

Usage: bun <command> [...flags] [...args]

Commands:
  run       ./my-script.ts       Execute a file with Bun
            lint                 Run a package.json script
  test                           Run unit tests with Bun
  x         vite                 Execute a package binary (CLI), installing if needed (bunx)
  repl                           Start a REPL session with Bun
  exec                           Run a shell script directly with Bun

  install                        Install dependencies for a package.json (bun i)
  add       @remix-run/dev       Add a dependency to package.json (bun a)
  remove    browserify           Remove a dependency from package.json (bun rm)
  update    @evan/duckdb         Update outdated dependencies
  audit                          Check installed packages for vulnerabilities
  outdated                       Display latest versions of outdated dependencies
  link      [<package>]          Register or link a local npm package
  unlink                         Unregister a local npm package
  publish                        Publish a package to the npm registry
  patch <pkg>                    Prepare a package for patching
  pm <subcommand>                Additional package management utilities
  info      @zarfjs/zarf         Display package metadata from the registry
  why       zod                  Explain why a package is installed

  build     ./a.ts ./b.jsx       Bundle TypeScript & JavaScript into a single file

  init                           Start an empty Bun project from a built-in template
  create    vite                 Create a new project from a template (bun c)
  upgrade                        Upgrade to latest version of Bun.
  feedback  ./file1 ./file2      Provide feedback to the Bun team.

  <command> --help               Print help text for command.

Learn more about Bun:            https://bun.com/docs
Join our Discord community:      https://bun.com/discord

yeah it looks like the bun command is not running properly. this is the version of bun instead of opencode

> opencode --version
1.3.0
@nicoburniske commented on GitHub (Nov 2, 2025): I tried using opencode on nixos from [nixpkgs/master branch](https://github.com/NixOS/nixpkgs/blob/master/pkgs/by-name/op/opencode/package.nix) and it fails like this. as if the `bun run` or whatever entry point command is failing. so I assume I can't run the pre-built binaries for some reason... ``` > opencode Bun is a fast JavaScript runtime, package manager, bundler, and test runner. (1.3.0+b0a6feca5) Usage: bun <command> [...flags] [...args] Commands: run ./my-script.ts Execute a file with Bun lint Run a package.json script test Run unit tests with Bun x vite Execute a package binary (CLI), installing if needed (bunx) repl Start a REPL session with Bun exec Run a shell script directly with Bun install Install dependencies for a package.json (bun i) add @remix-run/dev Add a dependency to package.json (bun a) remove browserify Remove a dependency from package.json (bun rm) update @evan/duckdb Update outdated dependencies audit Check installed packages for vulnerabilities outdated Display latest versions of outdated dependencies link [<package>] Register or link a local npm package unlink Unregister a local npm package publish Publish a package to the npm registry patch <pkg> Prepare a package for patching pm <subcommand> Additional package management utilities info @zarfjs/zarf Display package metadata from the registry why zod Explain why a package is installed build ./a.ts ./b.jsx Bundle TypeScript & JavaScript into a single file init Start an empty Bun project from a built-in template create vite Create a new project from a template (bun c) upgrade Upgrade to latest version of Bun. feedback ./file1 ./file2 Provide feedback to the Bun team. <command> --help Print help text for command. Learn more about Bun: https://bun.com/docs Join our Discord community: https://bun.com/discord ``` yeah it looks like the bun command is not running properly. this is the version of `bun` instead of `opencode` ``` > opencode --version 1.3.0 ```
Author
Owner

@delafthi commented on GitHub (Nov 2, 2025):

Yes, I'm aware of this issue. Probably due to autoPatchelfHook. I missed this because I'm on aarch64-darwin. See https://github.com/NixOS/nixpkgs/pull/457565#issuecomment-3477928505. Tomorrow I'll have access to a Linux machine and will test if removing autoPatchelfHook fixes the issue.

@delafthi commented on GitHub (Nov 2, 2025): Yes, I'm aware of this issue. Probably due to `autoPatchelfHook`. I missed this because I'm on `aarch64-darwin`. See https://github.com/NixOS/nixpkgs/pull/457565#issuecomment-3477928505. Tomorrow I'll have access to a Linux machine and will test if removing `autoPatchelfHook` fixes the issue.
Author
Owner

@delafthi commented on GitHub (Nov 2, 2025):

@nicoburniske I opened a PR which can be merged, as soon as someone tested it on Linux -> https://github.com/NixOS/nixpkgs/pull/457816

@delafthi commented on GitHub (Nov 2, 2025): @nicoburniske I opened a PR which can be merged, as soon as someone tested it on Linux -> https://github.com/NixOS/nixpkgs/pull/457816
Author
Owner

@thdxr commented on GitHub (Nov 2, 2025):

i haven't yet updated the aur script for opencode package. if you look at script/build.ts this is currently how we build it

@thdxr commented on GitHub (Nov 2, 2025): i haven't yet updated the aur script for `opencode` package. if you look at `script/build.ts` this is currently how we build it
Author
Owner

@delafthi commented on GitHub (Nov 2, 2025):

i haven't yet updated the aur script for opencode package. if you look at script/build.ts this is currently how we build it

I'm not a Typescript dev, so I'm struggling to understand what needs to happen from looking at script/build.ts. If the intention is to update the AUR script, I'm happy to wait - PKGBUILD scripts are much easier for me to work with.

@delafthi commented on GitHub (Nov 2, 2025): > i haven't yet updated the aur script for `opencode` package. if you look at `script/build.ts` this is currently how we build it I'm not a Typescript dev, so I'm struggling to understand what needs to happen from looking at `script/build.ts`. If the intention is to update the AUR script, I'm happy to wait - PKGBUILD scripts are much easier for me to work with.
Author
Owner

@delafthi commented on GitHub (Nov 2, 2025):

I saw that you adapted the AUR script and I now have a working build - thanks 🙌 .

A minor detail I currently solve with a patch: It would be nice to be able to split fetching and packing the @opentui/core and @parcel/watcher modules from the actual building - maybe something that could be added to the build script.

@delafthi commented on GitHub (Nov 2, 2025): I saw that you adapted the AUR script and I now have a working build - thanks 🙌 . A minor detail I currently solve with a patch: It would be nice to be able to split fetching and packing the `@opentui/core` and `@parcel/watcher` modules from the actual building - maybe something that could be added to the build script.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2473