Nix flake for OpenCode — an AI-powered terminal code editor and desktop IDE.
Provides reproducible, declarative packaging of OpenCode for NixOS, Home Manager, and nix run.
OpenCode is an AI-powered code editor that runs in your terminal (CLI) or as a full desktop application (Electron). It brings AI-assisted development to your fingertips with features like code completion, chat, and multi-file editing — all while keeping your data local and private.
This flake packages both editions:
| Package | Description | Platforms |
|---|---|---|
opencode |
Terminal-based CLI editor | Linux, macOS |
opencode-desktop |
Desktop IDE (Electron) | Linux only |
- Nix with flakes enabled
- Linux (x86_64, aarch64) or macOS (x86_64, Apple Silicon)
- (Optional) NixOS or Home Manager for declarative installation
Try OpenCode immediately without installing permanently:
# Run the CLI editor
nix run github:Hy4ri/opencode-flake
# Run the desktop IDE
nix run github:Hy4ri/opencode-flake#opencode-desktopIn your NixOS configuration or Home Manager flake:
{
inputs.opencode.url = "github:Hy4ri/opencode-flake";
}Gives you access to both opencode and opencode-desktop through pkgs:
# NixOS (configuration.nix)
nixpkgs.overlays = [ inputs.opencode.overlays.default ];
# Home Manager
home-manager.users.<user>.nixpkgs.overlays = [ inputs.opencode.overlays.default ];Then install:
# NixOS
environment.systemPackages = [ pkgs.opencode pkgs.opencode-desktop ];
# Home Manager
home.packages = [ pkgs.opencode pkgs.opencode-desktop ];# Only the CLI
nixpkgs.overlays = [ inputs.opencode.overlays.opencode ];
# Only the desktop IDE
nixpkgs.overlays = [ inputs.opencode.overlays.opencode-desktop ];If you prefer not to use overlays, reference the packages directly:
{
inputs.opencode.url = "github:Hy4ri/opencode-flake";
outputs = { self, nixpkgs, opencode }: {
nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
({ pkgs, ... }: {
environment.systemPackages = [
opencode.packages.${pkgs.system}.opencode
opencode.packages.${pkgs.system}.opencode-desktop
];
})
];
};
};
}Enter a development environment with all tools needed for maintenance:
nix develop github:Hy4ri/opencode-flakeThe version is updated automatically via GitHub Actions daily. To update manually:
# Update to latest release
./update-version.sh
# Update to a specific version
./update-version.sh 1.16.0The script will download all platform archives, compute SRI hashes, and update version.json, opencode.nix, and opencode-desktop.nix.
The update workflow runs daily at 17:00 UTC and:
- Checks for a new upstream release
- Runs
update-version.shto fetch and hash all binaries - Updates
flake.lockto the latest nixpkgs - Verifies the flake evaluates and the CLI builds
- Commits and pushes only if verification passes
- Fork the repository
- Enter the dev shell:
nix develop - Make your changes
- Verify with
nix flake checkandnix build .#opencode - Submit a pull request
This flake packaging is provided under the MIT license.
Note: OpenCode itself may have its own license terms. Refer to the OpenCode repository for details.