NixOS: custom tools fail because they cannot find imported modules #3734

Open
opened 2026-02-16 17:41:16 -05:00 by yindo · 1 comment
Owner

Originally created by @JoshuaDietz on GitHub (Dec 21, 2025).

Originally assigned to: @rekram1-node on GitHub.

Description

On NixOS after configuring custom tools, for any message that I sent I only got error messages like

cannot find module '@opencode-ai/plugin' (when I tried to symlink my tools from my nixOS repo into the Opencode config repo)

and

ENOENT reading "/nix/store/somethingsomething...-opencode-.1.0.184/lib/opencode/node_modules/@opencode-ai/plugin/node_modules/zod" (when I let NixOS copy my tools from my NixOS repo into the Opencode config dir on rebuild)

After much trying around I've managed to make it work on my fork:

https://github.com/sst/opencode/compare/dev...JoshuaDietz:opencode:try-fix-nixos-plugins

But since I'm not experienced at all with NixOS packaging I honestly have no idea if this is a clean way to do it and if it's worth a PR. But I hope that it can maybe at least be a starting point for someone more competent than me 😆

OpenCode version

1.0.184

Steps to reproduce

  1. Install Opencode on NixOS with opencode.url = "github:sst/opencode (in flake.nix)
  2. Add a custom tool as described here: https://opencode.ai/docs/custom-tools
  3. Talk to Opencode in TUI mode. Immediately when sending a message I got one of the errors above

Screenshot and/or share link

No response

Operating System

NixOS 25.11

Terminal

Konsole

Originally created by @JoshuaDietz on GitHub (Dec 21, 2025). Originally assigned to: @rekram1-node on GitHub. ### Description On NixOS after configuring custom tools, for any message that I sent I only got error messages like ` cannot find module '@opencode-ai/plugin'` (when I tried to symlink my tools from my nixOS repo into the Opencode config repo) and `ENOENT reading "/nix/store/somethingsomething...-opencode-.1.0.184/lib/opencode/node_modules/@opencode-ai/plugin/node_modules/zod"` (when I let NixOS copy my tools from my NixOS repo into the Opencode config dir on rebuild) After much trying around I've managed to make it work on my fork: https://github.com/sst/opencode/compare/dev...JoshuaDietz:opencode:try-fix-nixos-plugins But since I'm not experienced at all with NixOS packaging I honestly have no idea if this is a clean way to do it and if it's worth a PR. But I hope that it can maybe at least be a starting point for someone more competent than me 😆 ### OpenCode version 1.0.184 ### Steps to reproduce 1. Install Opencode on NixOS with `opencode.url = "github:sst/opencode` (in flake.nix) 2. Add a custom tool as described here: https://opencode.ai/docs/custom-tools 3. Talk to Opencode in TUI mode. Immediately when sending a message I got one of the errors above ### Screenshot and/or share link _No response_ ### Operating System NixOS 25.11 ### Terminal Konsole
yindo added the bugnix labels 2026-02-16 17:41:16 -05:00
Author
Owner

@megalithic commented on GitHub (Dec 27, 2025):

getting this one too

@megalithic commented on GitHub (Dec 27, 2025): getting this one too
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3734