mirror of
https://github.com/cedev-1/opencode-nix.git
synced 2026-09-16 17:11:52 +00:00
OpenCode - AI coding agent built for the terminal, packaged for NixOS
- Nix 100%
|
|
||
|---|---|---|
| .gitignore | ||
| flake.lock | ||
| flake.nix | ||
| LICENSE | ||
| module.nix | ||
| overlay.nix | ||
| package.nix | ||
| README.md | ||
OpenCode for Nix/NixOS
OpenCode - AI coding agent built for the terminal, packaged for NixOS and Nix users.
About
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
Important Notes
⚠️ Special Packaging Requirements
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
Usage
With Flakes
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 ];
};
}
];
};
};
}
Direct Installation
nix profile install github:GutMutCode/opencode-nix
Run Without Installing
nix run github:GutMutCode/opencode-nix
Verification
# Check version
opencode --version # Should show: 1.0.62
# List available models
opencode models
# Run help
opencode --help
Building from Source
git clone https://github.com/GutMutCode/opencode-nix
cd opencode-nix
nix build
./result/bin/opencode --version
Troubleshooting
If 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.
Updating
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
License
MIT (for both the packaging code and OpenCode itself)