This overlay provides ebuilds for OpenCode, an AI-powered coding agent built for the terminal.
OpenCode is an AI coding agent that provides intelligent code assistance, completion, and generation capabilities directly in your terminal environment. This overlay builds OpenCode from source using the proper Gentoo build system integration.
-
Using eselect-repository (recommended):
sudo eselect repository add opencode-overlay git https://github.com/mattwollf/opencode-overlay.git sudo emaint sync -r opencode-overlay
-
Manual setup:
# Clone the overlay git clone https://github.com/mattwollf/opencode-overlay.git /var/db/repos/opencode-overlay # Add to repos.conf sudo mkdir -p /etc/portage/repos.conf sudo tee /etc/portage/repos.conf/opencode-overlay.conf <<EOF [opencode-overlay] location = /var/db/repos/opencode-overlay masters = gentoo priority = 50 auto-sync = no EOF
# Install the latest stable version (builds from source)
sudo emerge -av dev-util/opencode
# Or install the binary version (faster, pre-built)
sudo emerge -av dev-util/opencode-bin
# Or install the live version for development
sudo emerge -av =dev-util/opencode-9999- Category: dev-util
- Package: opencode
- Versions: 0.9.0, 0.5.29 (and live 9999)
- Homepage: https://opencode.ai
- Repository: https://github.com/sst/opencode
Build-time:
>=dev-lang/go-1.24- Go compiler for TUI componentsys-apps/bun- Bun runtime for Node.js build
Runtime:
sys-apps/fzf- Fuzzy findersys-apps/ripgrep- Fast text search
test- Run package test suite during build
The ebuild handles a complex multi-language build:
- Dependency Installation: Uses Bun to install Node.js dependencies
- Go TUI Build: Compiles the Terminal User Interface component in Go
- Main Binary Build: Uses Bun to compile the main TypeScript application to a native binary
- Integration: Links both components into a single
opencodeexecutable
For development purposes, install the live version:
sudo emerge -av =dev-util/opencode-9999This builds from the latest git commit and is useful for:
- Testing new features
- Development and debugging
- Contributing to the project
The overlay includes automation scripts in the scripts/ directory:
Automatically updates ebuilds to the latest GitHub release:
# Update to latest release
./scripts/update-ebuild.sh
# Update to specific version
./scripts/update-ebuild.sh -v 0.6.0
# Force update even if ebuild exists
./scripts/update-ebuild.sh -fComprehensive testing of ebuilds:
# Test the newest available ebuild
sudo ./scripts/test-ebuild.sh
# Test specific version
sudo ./scripts/test-ebuild.sh -v 0.5.29
# Setup overlay only (no tests)
sudo ./scripts/test-ebuild.sh --setup-only# Test ebuild syntax
ebuild opencode-0.5.29.ebuild clean
# Generate manifest
ebuild opencode-0.5.29.ebuild manifest
# Test compilation without installing
ebuild opencode-0.5.29.ebuild compile
# Install to temporary directory
ebuild opencode-0.5.29.ebuild installAfter installation, you may need to configure your AI provider:
- API Keys: Set up your preferred AI provider (Claude, OpenAI, etc.)
- Configuration: Check
~/.opencode/for configuration files - Documentation: Visit https://opencode.ai/docs for detailed setup
This overlay features automated version updates similar to Dependabot:
- Daily checks at 6 AM UTC for new OpenCode releases
- Automatic PR creation when new versions are detected
- GitHub Actions testing validates ebuilds before merge
- Manual trigger available via workflow dispatch
- ✅ Latest Version: 0.9.0 (auto-updated from 0.5.29)
- ✅ Automated Detection: Working
- ✅ PR Generation: Working
- ✅ CI Testing: Functional
dev-util/opencode- Source package (builds from source)dev-util/opencode-bin- Binary package (uses pre-built releases)dev-util/opencode-9999- Live package (latest git main)
All packages are automatically updated when new versions are released.
-
Node.js not found:
sudo emerge -av net-libs/nodejs
-
Go version too old:
sudo emerge -av '>=dev-lang/go-1.24' -
Build failures:
- Check build log in
/var/tmp/portage/dev-util/opencode-*/temp/ - Ensure all dependencies are installed
- Try the live version if stable fails
- Check build log in
- OpenCode Issues: https://github.com/sst/opencode/issues
- Overlay Issues: https://github.com/mattwollf/opencode-overlay/issues
- Gentoo Forums: https://forums.gentoo.org/
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Test your changes thoroughly
- Submit a pull request
- Follow Gentoo ebuild standards
- Test on multiple architectures if possible
- Update automation scripts as needed
- Maintain backward compatibility
This overlay is licensed under the GPL-2, in accordance with Gentoo policies. The OpenCode software itself is licensed under the MIT license.
- Name: mw
- Email: mattwollf@gmail.com
- GitHub: https://github.com/mattwollf/opencode-overlay
Note: This overlay is community-maintained and not officially supported by the OpenCode or Gentoo teams.