diff --git a/flake.lock b/flake.lock index 05b1f20..dde9d7d 100644 --- a/flake.lock +++ b/flake.lock @@ -613,6 +613,22 @@ "type": "github" } }, + "opencode-anthropic-user-agent-plugin": { + "flake": false, + "locked": { + "lastModified": 1773977067, + "narHash": "sha256-KUW3npBSvCYU5kEULmNI0MLBf6r6DFH1DUKNKNmul9Q=", + "owner": "dotCipher", + "repo": "opencode-anthropic-user-agent-plugin", + "rev": "5981826955f0429583ad8a5a25fd2909d292d882", + "type": "github" + }, + "original": { + "owner": "dotCipher", + "repo": "opencode-anthropic-user-agent-plugin", + "type": "github" + } + }, "pre-commit": { "inputs": { "flake-compat": "flake-compat_2", @@ -653,6 +669,7 @@ "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", "noctalia": "noctalia", + "opencode-anthropic-user-agent-plugin": "opencode-anthropic-user-agent-plugin", "rust-overlay": "rust-overlay", "zen-browser": "zen-browser" } diff --git a/flake.nix b/flake.nix index 801a4c9..3ac9f1f 100644 --- a/flake.nix +++ b/flake.nix @@ -83,6 +83,11 @@ url = "github:ChrisOboe/json2steamshortcut"; inputs.nixpkgs.follows = "nixpkgs"; }; + + opencode-anthropic-user-agent-plugin = { + url = "github:dotCipher/opencode-anthropic-user-agent-plugin"; + flake = false; + }; }; outputs = diff --git a/home-manager/progs/opencode.nix b/home-manager/progs/opencode.nix index 5ef4a26..c78cd9e 100644 --- a/home-manager/progs/opencode.nix +++ b/home-manager/progs/opencode.nix @@ -39,10 +39,13 @@ let writing.model = "openrouter/google/gemini-3-flash-preview"; }; }; + oh-my-opencode-pkg = inputs.llm-agents.packages.${pkgs.stdenv.hostPlatform.system}.oh-my-opencode; + + anthropic-user-agent-plugin = inputs.opencode-anthropic-user-agent-plugin; in { home.packages = [ - inputs.llm-agents.packages.${pkgs.stdenv.hostPlatform.system}.oh-my-opencode + oh-my-opencode-pkg pkgs.playwright-driver.browsers ]; @@ -53,6 +56,13 @@ in xdg.configFile."opencode/oh-my-opencode.json".text = builtins.toJSON ohMyOpencodeConfig; + # Plugins are placed directly in the plugins directory so opencode + # auto-discovers them instead of downloading them from npm at runtime. + xdg.configFile."opencode/plugins/oh-my-opencode.js".source = + "${oh-my-opencode-pkg}/lib/oh-my-opencode/dist/index.js"; + xdg.configFile."opencode/plugins/opencode-anthropic-user-agent-plugin.js".source = + "${anthropic-user-agent-plugin}/index.js"; + xdg.configFile."opencode/skills/playwright.md".text = let browsers = pkgs.playwright-driver.browsers; @@ -166,11 +176,8 @@ in small_model = "openrouter/openai/gpt-oss-20b:free"; autoshare = false; - # note: this updates opencode (and plugins like oh-my-opencode) at launch, - # bypassing the version pinned in flake.lock - autoupdate = true; + autoupdate = false; agent = { }; - plugin = [ "oh-my-opencode" ]; provider = { openrouter = { models = {