OpenCode - AI coding agent built for the terminal, packaged for NixOS and Nix users.
This flake provides OpenCode v1.1.14 from npm platform-specific packages.
- Version: 1.1.14
- Source: npm registry (opencode-linux-x64, etc.)
- License: MIT
- Homepage: https://opencode.ai
This package uses a Bun-based binary that requires special handling:
autoPatchelfHookandstripare disabled to prevent binary corruption- Only the ELF interpreter is manually patched using
patchelf - See
docs/custom-package-troubleshooting.mdfor details
Add to your flake.nix:
{
inputs = {
opencode.url = "github:GutMutCode/opencode-nix";
};
outputs = { self, nixpkgs, opencode, ... }: {
nixosConfigurations.your-host = nixpkgs.lib.nixosSystem {
modules = [
{
nixpkgs.overlays = [ opencode.overlays.default ];
home-manager.users.your-user = {
home.packages = [ pkgs.opencode ];
};
}
];
};
};
}nix profile install github:GutMutCode/opencode-nixnix run github:GutMutCode/opencode-nix# Check version
opencode --version # Should show: 1.0.62
# List available models
opencode models
# Run help
opencode --helpgit clone https://github.com/GutMutCode/opencode-nix
cd opencode-nix
nix build
./result/bin/opencode --versionIf you see Bun help instead of OpenCode help, the binary may have been corrupted by build hooks. This package is specifically configured to avoid this issue. See the inline comments in package.nix for details.
To update to a newer version:
- Check latest version:
npm view opencode-ai version - Update
versioninpackage.nix - Update SHA256 hashes:
nix-prefetch-url --type sha256 https://registry.npmjs.org/opencode-linux-x64/-/opencode-linux-x64-VERSION.tgz # Repeat for other platforms - Update version in README
MIT (for both the packaging code and OpenCode itself)