Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


# OpenCode Nix Flake

This repository packages [OpenCode](https://github.com/sst/opencode), a terminal-based AI assistant for developers, as a Nix flake. OpenCode is developed by SST (Serverless Stack) and provides powerful AI-powered coding assistance directly in your terminal.
Expand Down Expand Up @@ -39,14 +41,13 @@ nix profile install github:aodhanhayter/opencode-flake

## Packaging

This flake builds OpenCode from source, copying the approach from the official nixpkgs build. If you don't require the latest version of opencode, I recommend using the official nixpkgs version as it will likely be more stable and well tested.
This flake packages OpenCode by downloading **pre-built binaries** from the npm registry, rather than building from source. If you don't require the latest version of opencode, I recommend using the official nixpkgs version as it will likely be more stable and well tested.

- **Source-based builds**: Fetches source code directly from the [sst/opencode](https://github.com/sst/opencode) repository
- **Multi-component build system**:
- **Go TUI Component**: Builds the terminal UI (`packages/tui`) using `buildGoModule`
- **TypeScript Core**: Uses Bun to compile the main application logic
- **Deterministic builds**: Includes a local models patch to avoid network dependencies during build
- **Cross-platform support**: Supports all major platforms with proper platform-specific library linking
- **Binary-based packaging**: Downloads pre-compiled tarballs directly from the npm registry
- **Platform-specific binaries**: Correctly maps and unpacks binaries for each supported system (`opencode-ai` plus platform-specific packages)
- **FHS directory structure**: Creates a proper Linux filesystem hierarchy structure in the Nix store
- **Environment setup**: Uses `makeWrapper` to configure necessary environment variables for the binary
- **Cross-platform support**: Supports all major platforms with proper architecture-to-system mapping

## Development

Expand Down