# OpenCode Nix Package Format Reference

This file shows the structure of the OpenCode Nix package that scripts will modify.

**Key fields to update:**
- Line 10: `version = "1.0.44";` - Update version number
- Line 14: `sha256 = "sha256-...";` - Update SRI hash

**URL pattern (line 13):**
```
https://github.com/sst/opencode/releases/download/v${finalAttrs.version}/opencode-linux-x64.zip
```

**Example package file:**

```nix
{ lib
, stdenvNoCC
, fetchzip
, autoPatchelfHook
, stdenv
}:

stdenvNoCC.mkDerivation (finalAttrs: {
  pname = "opencode";
  version = "1.0.44";  # Pinned: works with opencode-skills@0.1.0

  src = fetchzip {
    url = "https://github.com/sst/opencode/releases/download/v${finalAttrs.version}/opencode-linux-x64.zip";
    sha256 = "sha256-q3K5w1lhzd7GhBesKbaD3jDo2B/twUDLmi8wrkWzWh4=";
    stripRoot = false;
  };

  nativeBuildInputs = [
    autoPatchelfHook
  ];

  buildInputs = [
    stdenv.cc.cc.lib
  ];

  dontConfigure = true;
  dontBuild = true;
  dontStrip = true;

  installPhase = ''
    runHook preInstall
    install -Dm755 opencode $out/bin/opencode
    runHook postInstall
  '';

  meta = with lib; {
    description = "AI coding agent built for the terminal";
    homepage = "https://opencode.ai";
    license = licenses.mit;
    maintainers = [ ];
    platforms = [ "x86_64-linux" ];
    mainProgram = "opencode";
    sourceProvenance = with sourceTypes; [ binaryNativeCode ];
  };
})
```
