Skip to content

Packaging Guidance Request for v1.x #3739

Closed

Description

@delafthi

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.

Activity

  1. nicoburniske commented on Nov 2, 2025

    @nicoburniske

    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
    
  2. delafthi commented on Nov 2, 2025

    @delafthi
    ContributorAuthor

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

  3. delafthi commented on Nov 2, 2025

    @delafthi
    ContributorAuthor

    @nicoburniske I opened a PR which can be merged, as soon as someone tested it on Linux -> NixOS/nixpkgs#457816

  4. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Nov 2, 2025
  5. thdxr commented on Nov 2, 2025

    @thdxr
    Member

    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

  6. delafthi commented on Nov 3, 2025

    @delafthi
    ContributorAuthor

    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.

  7. delafthi commented on Nov 3, 2025

    @delafthi
    ContributorAuthor

    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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

opentuiThis relates to changes in v1.0, now that opencode uses opentui

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions