OpenCode - AI coding agent built for the terminal, packaged for NixOS
Find a file
GutMutCode d2e7696f5b
Merge pull request #2 from cedev-1/update-to-1.3.13
feat: update opencode to 1.3.13
2026-07-21 16:41:26 +09:00
.gitignore Initial commit: OpenCode v0.15.7 for Nix/NixOS 2025-10-18 20:54:35 +09:00
flake.lock Initial commit: OpenCode v0.15.7 for Nix/NixOS 2025-10-18 20:54:35 +09:00
flake.nix Initial commit: OpenCode v0.15.7 for Nix/NixOS 2025-10-18 20:54:35 +09:00
LICENSE Initial commit: OpenCode v0.15.7 for Nix/NixOS 2025-10-18 20:54:35 +09:00
module.nix Initial commit: OpenCode v0.15.7 for Nix/NixOS 2025-10-18 20:54:35 +09:00
overlay.nix Initial commit: OpenCode v0.15.7 for Nix/NixOS 2025-10-18 20:54:35 +09:00
package.nix feat: update opencode to 1.3.13 2026-04-01 21:31:16 +02:00
README.md Update OpenCode version to 1.1.14 2026-02-11 11:34:15 +09:00

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:

  • autoPatchelfHook and strip are disabled to prevent binary corruption
  • Only the ELF interpreter is manually patched using patchelf
  • See docs/custom-package-troubleshooting.md for 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:

  1. Check latest version: npm view opencode-ai version
  2. Update version in package.nix
  3. Update SHA256 hashes:
    nix-prefetch-url --type sha256 https://registry.npmjs.org/opencode-linux-x64/-/opencode-linux-x64-VERSION.tgz
    # Repeat for other platforms
    
  4. Update version in README

License

MIT (for both the packaging code and OpenCode itself)