From 8d46992bd105e94e529077936d5c39904a20c17d Mon Sep 17 00:00:00 2001 From: m3tam3re Date: Thu, 30 Jul 2026 07:01:22 +0200 Subject: [PATCH] feat: re-add opencode-desktop as pass-through from anomalyco/opencode Expose the opencode-desktop Electron app as a package via a pure pass-through from a new 'opencode' flake input (github:anomalyco/opencode/dev). The input intentionally does NOT follow nixpkgs: upstream pins a node_modules fixed-output derivation hash in nix/hashes.json against its own nixpkgs snapshot, so following would risk FOD hash mismatches. - flake.nix: add 'opencode' input (own nixpkgs, dev branch) - pkgs/default.nix: opencode-desktop pass-through - docs/packages/opencode.md + README.md: refreshed (Electron, not Tauri) - CHANGELOG: unreleased entry Verified: nix flake show lists opencode-desktop (all 4 systems); output opencode-desktop-1.18.9+f720490 builds & wraps electron-41. --- CHANGELOG.md | 3 ++ docs/packages/README.md | 2 +- docs/packages/opencode.md | 63 +++++++++++++++++++++++++-------------- flake.lock | 36 ++++++++++++++++++++++ flake.nix | 7 +++++ pkgs/default.nix | 3 +- 6 files changed, 90 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 18f1c64..5d23fd8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/). ## [Unreleased] +### Added +- `opencode-desktop` re-added as a pure pass-through from the `anomalyco/opencode` flake input (Electron app, tracked on `dev`); the input intentionally does not follow nixpkgs so upstream's `node_modules` FOD hashes stay valid + ### Fixed - `openwork` 0.17.30: upstream renamed desktop/icon assets from `@openworkdesktop.{desktop,png}` to `openwork.{desktop,png}` and dropped the `Icon=`/`--no-sandbox` substitutions that are no longer needed diff --git a/docs/packages/README.md b/docs/packages/README.md index 7c51e04..ddf95a7 100644 --- a/docs/packages/README.md +++ b/docs/packages/README.md @@ -43,7 +43,7 @@ These packages are imported directly from flake inputs with minor modifications: | Package | Source | Modification | Location | |---------|--------|-------------|----------| -| `opencode-desktop` | `inputs.opencode` | Tauri desktop wrapper + Wayland fix | `pkgs/opencode-desktop/` | +| `opencode-desktop` | `inputs.opencode` | Electron desktop app (pure pass-through) | `pkgs/default.nix` | ## Adding Package Documentation diff --git a/docs/packages/opencode.md b/docs/packages/opencode.md index dc5fff8..56195cd 100644 --- a/docs/packages/opencode.md +++ b/docs/packages/opencode.md @@ -1,37 +1,56 @@ -# opencode (Deprecated) +# opencode & opencode-desktop -> **Note**: The `opencode` package has been removed from this repository. +## opencode (CLI) -## Why was it removed? - -OpenCode (CLI version) has been removed because there is now a well-maintained upstream repository for AI coding tools: +The standalone `opencode` CLI is **not** packaged here. Use the well-maintained +upstream flake instead: **[numtide/llm-agents.nix](https://github.com/numtide/llm-agents.nix)** -This repository provides Nix packages for various AI coding agents, including OpenCode and others, with active maintenance and updates. - -## What should I use instead? - -Use the [llm-agents.nix](https://github.com/numtide/llm-agents.nix) flake directly: - ```nix { - inputs = { - llm-agents.url = "github:numtide/llm-agents.nix"; - }; - - outputs = { inputs, ... }: { - # Access packages via inputs.llm-agents.packages.${system} - }; + inputs.llm-agents.url = "github:numtide/llm-agents.nix"; } ``` -Or run directly: - ```bash nix run github:numtide/llm-agents.nix#opencode ``` -## What about opencode-desktop? +## opencode-desktop -The `opencode-desktop` package remains available in this repository as it includes a Wayland support workaround for [upstream issue #11755](https://github.com/opencode-ai/opencode/issues/11755). Once this issue is resolved upstream, `opencode-desktop` may also be removed in favor of the llm-agents.nix repository. +`opencode-desktop` is provided as a **pure pass-through** from the upstream +flake input [`anomalyco/opencode`](https://github.com/anomalyco/opencode) +(tracked on the `dev` branch). It is the official Electron desktop app built +upstream via `nix/desktop.nix`. + +```bash +nix build git+https://code.m3ta.dev/m3tam3re/nixpkgs#opencode-desktop +nix run git+https://code.m3ta.dev/m3tam3re/nixpkgs#opencode-desktop +``` + +### How it is wired + +- **Flake input** (`flake.nix`): + + ```nix + opencode.url = "github:anomalyco/opencode/dev"; + ``` + + It intentionally does **not** follow this repo's `nixpkgs`: upstream pins a + `node_modules` fixed-output derivation hash in `nix/hashes.json` against its + own nixpkgs snapshot, so following would risk FOD hash mismatches. + +- **Registry** (`pkgs/default.nix`): + + ```nix + opencode-desktop = inputs.opencode.packages.${system}.opencode-desktop; + ``` + + No local derivation exists — the package is imported as-is. + +### Wayland + +The upstream wrapper already passes `--ozone-platform-hint=auto` (plus Wayland +window decorations and IME flags) when `NIXOS_OZONE_WL` is set, so no local +Wayland wrapper is required. diff --git a/flake.lock b/flake.lock index a0e7293..59463df 100644 --- a/flake.lock +++ b/flake.lock @@ -69,6 +69,41 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1776683584, + "narHash": "sha256-NuTLMrr10Tng72hurYG8jYQ4XKK8wnpJmOGcPiis96g=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9dd5558b06dbdacbf635a3dd36dce1b1a7ee3a89", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "opencode": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1785386452, + "narHash": "sha256-iYfkMmn1ZKbi0cv8XIAXVgPH4idzsVSK4cWyi/KGMJQ=", + "owner": "anomalyco", + "repo": "opencode", + "rev": "f7204902192624481e526b1852cdedaadb914e24", + "type": "github" + }, + "original": { + "owner": "anomalyco", + "ref": "dev", + "repo": "opencode", + "type": "github" + } + }, "openspec": { "inputs": { "nixpkgs": [ @@ -95,6 +130,7 @@ "basecamp": "basecamp", "nixpkgs": "nixpkgs", "nixpkgs-master": "nixpkgs-master", + "opencode": "opencode", "openspec": "openspec" } } diff --git a/flake.nix b/flake.nix index f626b22..4cbf5e6 100644 --- a/flake.nix +++ b/flake.nix @@ -16,6 +16,13 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + # opencode - open-source coding agent; provides the opencode-desktop + # Electron app. NOTE: intentionally does NOT follow nixpkgs. Upstream + # pins a node_modules fixed-output derivation hash in nix/hashes.json + # against its own nixpkgs snapshot; following would risk FOD hash + # mismatches. Tracking the `dev` default branch (flake.lock pins the rev). + opencode.url = "github:anomalyco/opencode/dev"; + # Agent definitions and coding rules agents = { url = "git+https://code.m3ta.dev/m3tam3re/AGENTS"; diff --git a/pkgs/default.nix b/pkgs/default.nix index 666416f..6a3a555 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -3,7 +3,7 @@ # Flake inputs used: # inputs.basecamp → basecamp (pass-through) # inputs.openspec → openspec (pass-through) -# inputs.opencode → opencode-desktop (build inputs + patches) +# inputs.opencode → opencode-desktop (Electron desktop app, pure pass-through) # inputs.agents → not used directly here (used by lib/) { pkgs, @@ -39,4 +39,5 @@ in { basecamp = inputs.basecamp.packages.${system}.default; openspec = inputs.openspec.packages.${system}.default; + opencode-desktop = inputs.opencode.packages.${system}.opencode-desktop; }