From ec06cd9887a31dde1e7be66463ffe1c0f46952a7 Mon Sep 17 00:00:00 2001 From: Adam0 Date: Fri, 17 Jul 2026 23:35:57 -0400 Subject: [PATCH] remove opencode, add tangled mcp --- default.nix | 1 - hm-modules/default.nix | 1 - hm-modules/opencode-plugins.nix | 132 --------- pkgs/opencode/default.nix | 138 --------- pkgs/opencode/hashes.json | 21 -- pkgs/opencode/plugins/README.md | 261 ------------------ .../plugins/cc-safety-net/default.nix | 28 -- pkgs/opencode/plugins/changelog/default.nix | 30 -- pkgs/opencode/plugins/default.nix | 132 --------- .../dynamic-context-pruning/default.nix | 33 --- pkgs/opencode/plugins/ignore/default.nix | 30 -- pkgs/opencode/plugins/lazy-mcp/default.nix | 30 -- pkgs/opencode/plugins/notifier/default.nix | 30 -- pkgs/opencode/plugins/quota/default.nix | 38 --- pkgs/opencode/plugins/unmoji/default.nix | 30 -- pkgs/tangled-mcp/default.nix | 48 ++++ 16 files changed, 48 insertions(+), 935 deletions(-) delete mode 100644 hm-modules/opencode-plugins.nix delete mode 100644 pkgs/opencode/default.nix delete mode 100644 pkgs/opencode/hashes.json delete mode 100644 pkgs/opencode/plugins/README.md delete mode 100644 pkgs/opencode/plugins/cc-safety-net/default.nix delete mode 100644 pkgs/opencode/plugins/changelog/default.nix delete mode 100644 pkgs/opencode/plugins/default.nix delete mode 100644 pkgs/opencode/plugins/dynamic-context-pruning/default.nix delete mode 100644 pkgs/opencode/plugins/ignore/default.nix delete mode 100644 pkgs/opencode/plugins/lazy-mcp/default.nix delete mode 100644 pkgs/opencode/plugins/notifier/default.nix delete mode 100644 pkgs/opencode/plugins/quota/default.nix delete mode 100644 pkgs/opencode/plugins/unmoji/default.nix create mode 100644 pkgs/tangled-mcp/default.nix diff --git a/default.nix b/default.nix index 85b00aa..ba69b6b 100644 --- a/default.nix +++ b/default.nix @@ -53,7 +53,6 @@ in # keep-sorted start gotifyPlugins = recurseIntoAttrs (callPackage ./pkgs/gotify-server/plugins {inherit (allPackages) gotify-server;}); hyprlandPlugins = recurseCallPackage ./pkgs/hyprland-plugins; - opencodePlugins = recurseCallPackage ./pkgs/opencode/plugins; spicetifyExtensions = recurseCallPackage ./pkgs/spicetify-extensions; yaziPlugins = recurseCallPackage ./pkgs/yazi-plugins; # keep-sorted end diff --git a/hm-modules/default.nix b/hm-modules/default.nix index e2e0dde..cf2c2f9 100644 --- a/hm-modules/default.nix +++ b/hm-modules/default.nix @@ -2,5 +2,4 @@ # Add your Home Manager modules here # # my-module = ./my-module; - opencode-plugins = ./opencode-plugins.nix; } diff --git a/hm-modules/opencode-plugins.nix b/hm-modules/opencode-plugins.nix deleted file mode 100644 index 63765c5..0000000 --- a/hm-modules/opencode-plugins.nix +++ /dev/null @@ -1,132 +0,0 @@ -{ - # keep-sorted start - config, - lib, - pkgs, - # keep-sorted end - ... -}: let - inherit - (builtins) - # keep-sorted start - attrNames - filter - # keep-sorted end - ; - inherit - (lib) - # keep-sorted start - genAttrs - literalExpression - mkAfter - mkEnableOption - mkIf - mkMerge - mkOption - optionalAttrs - types - # keep-sorted end - ; - inherit (pkgs) callPackage; - - jsonFormat = pkgs.formats.json {}; - - cfg = config.programs.opencode; - - pluginPackages = removeAttrs (callPackage ../pkgs/opencode/plugins {}) ["mkOpencodePlugin"]; - pluginNames = attrNames pluginPackages; - - pluginSource = name: "file://${pluginPackages.${name}}"; - - pluginOption = name: - mkOption { - default = {}; - type = types.submodule { - options = - { - enable = mkEnableOption "the ${name} opencode plugin"; - } - // optionalAttrs (name == "notifier") { - settings = mkOption { - type = types.nullOr jsonFormat.type; - default = null; - example = literalExpression '' - { - sound = false; - } - ''; - description = '' - Configuration written to $XDG_CONFIG_HOME/opencode/opencode-notifier.json. - The value is rendered to JSON and managed by Home Manager. - ''; - }; - } - // optionalAttrs (name == "quota") { - sidebar.enable = mkEnableOption "the opencode quota TUI sidebar"; - - settings = mkOption { - type = types.nullOr jsonFormat.type; - default = null; - example = literalExpression '' - { - enableToast = false; - enabledProviders = ["copilot" "openai"]; - formatStyle = "allWindows"; - percentDisplayMode = "used"; - } - ''; - description = '' - Configuration written to - $XDG_CONFIG_HOME/opencode/opencode-quota/quota-toast.json. - The value is rendered to JSON and managed by Home Manager. - ''; - }; - }; - }; - }; - - enabledPluginNames = filter (name: cfg.plugins.${name}.enable) pluginNames; - pluginSources = - map pluginSource enabledPluginNames - ++ map (pkg: "file://${pkg}") cfg.plugins.extraPackages; -in { - options.programs.opencode.plugins = mkOption { - default = {}; - description = "OpenCode plugin packages to enable and configure."; - type = types.submodule { - options = - genAttrs pluginNames pluginOption - // { - extraPackages = mkOption { - type = types.listOf types.package; - default = []; - example = literalExpression "[ pkgs.my-opencode-plugin ]"; - description = '' - Additional OpenCode plugin packages to append to - `programs.opencode.settings.plugin` as `file://` package roots. - ''; - }; - }; - }; - }; - - config = mkIf cfg.enable ( - mkMerge [ - (mkIf (pluginSources != []) {programs.opencode.settings.plugin = mkAfter pluginSources;}) - - (mkIf (cfg.plugins.notifier.settings != null) { - xdg.configFile."opencode/opencode-notifier.json".source = - jsonFormat.generate "opencode-notifier.json" cfg.plugins.notifier.settings; - }) - - (mkIf (cfg.plugins.quota.settings != null) { - xdg.configFile."opencode/opencode-quota/quota-toast.json".source = - jsonFormat.generate "quota-toast.json" cfg.plugins.quota.settings; - }) - - (mkIf cfg.plugins.quota.sidebar.enable { - programs.opencode.tui.plugin = mkAfter ["file://${pluginPackages.quota}"]; - }) - ] - ); -} diff --git a/pkgs/opencode/default.nix b/pkgs/opencode/default.nix deleted file mode 100644 index 7b99dae..0000000 --- a/pkgs/opencode/default.nix +++ /dev/null @@ -1,138 +0,0 @@ -{ - # keep-sorted start - autoPatchelfHook ? null, - fetchurl, - fzf, - lib, - makeWrapper, - ripgrep, - stdenv, - unzip, - versionCheckHomeHook ? null, - versionCheckHook, - wrapBuddy ? null, - writeShellScriptBin, - # keep-sorted end -}: let - pname = "opencode-vim"; - versionData = builtins.fromJSON (builtins.readFile ./hashes.json); - inherit (versionData) version hashes; - - platformMap = { - # keep-sorted start block=yes newline_separated=yes - aarch64-darwin = { - asset = "ocv-darwin-arm64.zip"; - isZip = true; - }; - - aarch64-linux = { - asset = "ocv-linux-arm64.tar.gz"; - isZip = false; - }; - - x86_64-darwin = { - asset = "ocv-darwin-x64.zip"; - isZip = true; - }; - - x86_64-linux = { - asset = "ocv-linux-x64.tar.gz"; - isZip = false; - }; - # keep-sorted end - }; - - platform = stdenv.hostPlatform.system; - platformInfo = platformMap.${platform} or (throw "Unsupported system: ${platform}"); - - src = fetchurl { - url = "https://github.com/leohenon/opencode/releases/download/v${version}/${platformInfo.asset}"; - hash = hashes.${platform}; - }; -in - stdenv.mkDerivation { - inherit pname version src; - - nativeBuildInputs = - [makeWrapper] - ++ lib.optionals platformInfo.isZip [unzip] - ++ lib.optionals (stdenv.hostPlatform.isLinux && autoPatchelfHook != null) [autoPatchelfHook] - ++ lib.optionals (stdenv.hostPlatform.isLinux && wrapBuddy != null) [wrapBuddy]; - - doInstallCheck = true; - nativeInstallCheckInputs = - [versionCheckHook] - ++ lib.optionals (versionCheckHomeHook != null) [versionCheckHomeHook] - ++ lib.optionals stdenv.hostPlatform.isDarwin [(writeShellScriptBin "sysctl" "echo 0")]; - versionCheckKeepEnvironment = "PATH"; - - buildInputs = lib.optionals stdenv.hostPlatform.isLinux [stdenv.cc.cc.lib]; - - # keep-sorted start - dontBuild = true; - dontConfigure = true; - dontStrip = true; - # keep-sorted end - - unpackPhase = - '' - runHook preUnpack - '' - + lib.optionalString platformInfo.isZip '' - unzip $src - '' - + lib.optionalString (!platformInfo.isZip) '' - tar -xzf $src - '' - + '' - runHook postUnpack - ''; - - installPhase = '' - runHook preInstall - - mkdir -p $out/bin - install -m755 opencode $out/bin/opencode - - wrapProgram $out/bin/opencode \ - --prefix PATH : ${ - lib.makeBinPath [ - # keep-sorted start - fzf - ripgrep - # keep-sorted end - ] - } - - runHook postInstall - ''; - - passthru.category = "AI Coding Agents"; - - meta = { - # keep-sorted start block=yes newline_separated=yes - changelog = "https://github.com/leohenon/opencode/releases/tag/v${version}"; - - description = "OpenCode Vim terminal AI coding agent"; - - homepage = "https://github.com/leohenon/opencode"; - - license = lib.licenses.mit; - - longDescription = "OpenCode Vim is a terminal-based coding agent. This package tracks the leohenon/opencode fork with the opencode-vim feature set."; - - mainProgram = "opencode"; - - platforms = [ - # keep-sorted start - "aarch64-darwin" - "aarch64-linux" - "x86_64-darwin" - "x86_64-linux" - # keep-sorted end - ]; - - sourceProvenance = with lib.sourceTypes; [binaryNativeCode]; - # keep-sorted end - }; - } diff --git a/pkgs/opencode/hashes.json b/pkgs/opencode/hashes.json deleted file mode 100644 index 3177105..0000000 --- a/pkgs/opencode/hashes.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "version": "1.18.3-ocv.4.8", - "updater": { - "type": "github-release-assets", - "owner": "leohenon", - "repo": "opencode", - "tagPrefix": "v", - "assets": { - "aarch64-darwin": "ocv-darwin-arm64.zip", - "aarch64-linux": "ocv-linux-arm64.tar.gz", - "x86_64-darwin": "ocv-darwin-x64.zip", - "x86_64-linux": "ocv-linux-x64.tar.gz" - } - }, - "hashes": { - "aarch64-darwin": "sha256-NPKw5P7aMROIL5rjqanIj4ekZZXqKCcNDBQjRPI7M8E=", - "aarch64-linux": "sha256-jEwmPWJpKGDL5cH86l8VPMpUc6VXEqngPR8BxGtWUy8=", - "x86_64-darwin": "sha256-t5RlHo3LrIYhtIJVjNHZiyiCTXlY1vS/yHvEwhQa0Pw=", - "x86_64-linux": "sha256-tH85vuIDv44eBCtFssizqRlSXuqE6RfLp8KCz3zOCq4=" - } -} diff --git a/pkgs/opencode/plugins/README.md b/pkgs/opencode/plugins/README.md deleted file mode 100644 index 98b82d9..0000000 --- a/pkgs/opencode/plugins/README.md +++ /dev/null @@ -1,261 +0,0 @@ -# OpenCode Plugin Packaging Guide - -This guide is for agents adding or updating packages under `pkgs/opencode/plugins`. - -## Objective - -Package each plugin so OpenCode can load multiple plugins reliably from Nix store -paths with no runtime rebuild hacks. - -## Rules That Must Hold - -1. Consumer configs must reference plugin package roots, not explicit entry files. - - Use: `file://${pkg}` - - Do not use: `file://${pkg}/dist/index.js` -2. Package root import must resolve to runtime JavaScript. - - `package.json` `main` must point to built JS (usually `dist/index.js`). -3. All required generated files must exist in `$out`. - - If plugin needs codegen/build, run it in `postInstall`. -4. Plugin package must pass both build-time and import-time checks before merge. - -## Current Builder Contract - -`mkOpencodePlugin` in `pkgs/opencode/plugins/default.nix`: - -- Copies dependencies to `./node_modules`. -- Supports optional `dependencyInstallCommand` for plugins that need non-default - dependency installation. -- Runs optional `buildCommand` before files are copied to `$out`. -- Copies source tree to `$out`. -- Runs `postInstall` after files are in `$out`. -- Supports per-plugin toolchain extensions via: - - `nativeBuildInputs = [bun] ++ (args.nativeBuildInputs or [])` - -Implication: use `buildCommand` for normal compilation and keep `postInstall` -for package-root tweaks that must happen in `$out`. - -## New Plugin Workflow - -1. Create `pkgs/opencode/plugins//default.nix`. -2. Choose dependency strategy: - - `dependencyHash = null` for no external npm deps. - - Set `dependencyHash` for plugins requiring `node_modules`. -3. Add normal compilation in `buildCommand`; keep `postInstall` only for - package-root tweaks in `$out`. -4. Ensure output `package.json` `main` resolves to JS at runtime. -5. Build and smoke-test import. -6. Update consumer config to use package-root URL (`file://${pkg}`). - -## Template - -```nix -{ - lib, - fetchFromGitHub, - mkOpencodePlugin, - # Add toolchain deps only when required by build/codegen. - typescript ? null, -}: -mkOpencodePlugin rec { - pname = ""; - version = ""; - - src = fetchFromGitHub { - owner = ""; - repo = ""; - rev = "v${version}"; - hash = "sha256-..."; - }; - - # Use null if plugin has no runtime npm dependencies. - dependencyHash = "sha256-..."; - - # Optional: add per-plugin build tools. - nativeBuildInputs = lib.optionals (typescript != null) [typescript]; - - # Optional: compile sources before install. - buildCommand = "bun run build"; - - # Optional: package-root tweaks inside $out. - postInstall = '' - - # If upstream main points to TS, rewrite to built JS. - substituteInPlace package.json \ - --replace-fail '"main": "index.ts"' '"main": "dist/index.js"' - ''; - - meta = { - description = ""; - homepage = "https://github.com//"; - license = lib.licenses.mit; - }; -} -``` - -## Validation Checklist - -For plugin ``: - -1. Build: - -```bash -nix-build -A opencodePlugins. --no-out-link -``` - -2. Import package root (not a file inside dist): - -```bash -out=$(nix-build -A opencodePlugins. --no-out-link) -bun -e "await import('file://$out'); console.log('ok')" -``` - -3. Verify all plugins still load together: - -```bash -opencode debug config --print-logs --log-level DEBUG -``` - -Look for one `service=plugin path=file:///nix/store/...` line per plugin. - -## Known Failure Modes - -- Symptom: only one custom plugin appears loaded. - - Cause: explicit `.../dist/index.js` plugin URLs. - - Fix: switch all plugin URLs to package roots (`file://${pkg}`). - -- Symptom: `Cannot find module` for generated files. - - Cause: codegen step missing. - - Fix: run generator in `postInstall` before compile. - -- Symptom: package-root import fails but `dist/index.js` exists. - - Cause: `package.json` `main` still points to TS. - - Fix: rewrite `main` to `dist/index.js` in `postInstall`. - -- Symptom: TS compile fails in sandbox due missing toolchain. - - Cause: build tools not present. - - Fix: add tools via `nativeBuildInputs` (for example `typescript`). - -## Existing Package Patterns - -- `cc-safety-net`: no extra build step. -- `dynamic-context-pruning`: `tsc` compile. -- `notifier`: upstream build script (`bun run build`). -- `morph-fast-apply`: direct bun build + main rewrite. -- `unmoji`: `fetchFromCodeberg` + direct - `bun build src/index.ts --outdir dist --target node --format esm`. - -## Consumer Config Pattern - -Two supported consumption patterns are documented here. - -### Direct OpenCode Config - -In Home Manager/NixOS config, load package roots only: - -```nix -programs.opencode.settings.plugin = [ - "file://${pkgs.nur.repos.adam0.opencodePlugins.}" -]; -``` - -### Home Manager Module - -This repository also exports a Home Manager module that adds -`programs.opencode.plugins..enable`, -`programs.opencode.plugins.auto-resume.settings`, -`programs.opencode.plugins.notifier.settings`, -`programs.opencode.plugins.quota.settings`, and -`programs.opencode.plugins.extraPackages`. - -When using flakes, enable the NUR overlay in configuration so `pkgs.nur` is -available on the existing package set, then import -`pkgs.nur.repos.adam0.hmModules.opencode-plugins`: - -```nix -{ - outputs = inputs@{ self, nixpkgs, home-manager, nur, ... }: { - homeConfigurations.me = home-manager.lib.homeManagerConfiguration { - pkgs = import nixpkgs { - system = "x86_64-linux"; - }; - modules = [ - { - nixpkgs.overlays = [ nur.overlays.default ]; - } - pkgs.nur.repos.adam0.hmModules.opencode-plugins - { - programs.opencode = { - enable = true; - - plugins.notifier = { - enable = true; - settings = { - sound = false; - }; - }; - - plugins.auto-resume = { - enable = true; - settings = { - chunkTimeoutMs = 45000; - maxRetries = 3; - }; - }; - - plugins.quota = { - enable = true; - sidebar.enable = true; - settings = { - enableToast = false; - enabledProviders = [ "copilot" "openai" ]; - formatStyle = "allWindows"; - percentDisplayMode = "used"; - }; - }; - - plugins..enable = true; - - plugins.extraPackages = [ - pkgs.my-opencode-plugin - ]; - }; - } - ]; - }; - }; -} -``` - -`programs.opencode.plugins.notifier.settings` accepts either: - -- a JSON attrset/list/value, which is written to - `opencode/opencode-notifier.json` -- a path to an existing JSON file, which is used as the file source directly - -Example with an existing file: - -```nix -programs.opencode.plugins.notifier.settings = ./opencode-notifier.json; -``` - -`programs.opencode.plugins.auto-resume.settings` accepts a JSON attrset/list/value -and writes the plugin entry as: - -```nix -[ - "file://${pkgs.nur.repos.adam0.opencodePlugins.auto-resume}" - { - chunkTimeoutMs = 45000; - maxRetries = 3; - } -] -``` - -The module still writes package-root plugin URLs under the hood, so do not use -explicit entrypoint paths like `/dist/index.js`. - -`programs.opencode.plugins.quota.settings` accepts a JSON attrset/list/value, -which is written to `opencode/opencode-quota/quota-toast.json`. - -`programs.opencode.plugins.quota.sidebar.enable` appends the quota plugin -package root to `programs.opencode.tui.plugin` so the TUI sidebar can load. diff --git a/pkgs/opencode/plugins/cc-safety-net/default.nix b/pkgs/opencode/plugins/cc-safety-net/default.nix deleted file mode 100644 index 4a4d214..0000000 --- a/pkgs/opencode/plugins/cc-safety-net/default.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ - # keep-sorted start - fetchFromGitHub, - lib, - mkOpencodePlugin, - # keep-sorted end -}: -mkOpencodePlugin rec { - pname = "cc-safety-net"; - version = "1.0.6"; - - src = fetchFromGitHub { - owner = "kenryu42"; - repo = "claude-code-safety-net"; - rev = "v${version}"; - hash = "sha256-EniF9gjEWe6+FaSrC4PyoTN4w9FlyhZ+eU7Bp1X/USY="; - }; - - dependencyHash = null; - - meta = { - # keep-sorted start - description = "A coding agent hook that acts as a safety net"; - homepage = "https://github.com/kenryu42/claude-code-safety-net"; - license = lib.licenses.mit; - # keep-sorted end - }; -} diff --git a/pkgs/opencode/plugins/changelog/default.nix b/pkgs/opencode/plugins/changelog/default.nix deleted file mode 100644 index 1f3791e..0000000 --- a/pkgs/opencode/plugins/changelog/default.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ - # keep-sorted start - fetchFromGitHub, - lib, - mkOpencodePlugin, - # keep-sorted end -}: -mkOpencodePlugin rec { - pname = "changelog"; - version = "1.0.0"; - - src = fetchFromGitHub { - owner = "tobwen"; - repo = "opencode-${pname}"; - rev = "v${version}"; - hash = "sha256-DiFqIMSXB4ba44x/7H9k/nH2YBWUy+Kt98gpo5Q/iX8="; - }; - - dependencyHash = null; - - buildCommand = "bun build src/index.ts --outdir dist --target node --format esm"; - - meta = { - # keep-sorted start - description = "OpenCode plugin that adds a /changelog command"; - homepage = "https://github.com/tobwen/opencode-changelog"; - license = lib.licenses.mit; - # keep-sorted end - }; -} diff --git a/pkgs/opencode/plugins/default.nix b/pkgs/opencode/plugins/default.nix deleted file mode 100644 index fcb1d53..0000000 --- a/pkgs/opencode/plugins/default.nix +++ /dev/null @@ -1,132 +0,0 @@ -{ - # keep-sorted start - bun, - callPackage, - lib, - stdenvNoCC, - # keep-sorted end -}: let - inherit - (builtins) - # keep-sorted start - mapAttrs - readDir - # keep-sorted end - ; - inherit - (lib) - # keep-sorted start - filterAttrs - pipe - platforms - # keep-sorted end - ; - - root = ./.; - - mkOpencodePlugin = args @ { - # keep-sorted start - buildCommand ? null, - dependencyHash ? null, - dependencyInstallCommand ? "bun install --no-cache --production", - meta ? {}, - pname, - src, - version, - # keep-sorted end - ... - }: let - deps = - if dependencyHash == null - then - stdenvNoCC.mkDerivation { - pname = "${pname}-deps"; - inherit version src; - - # keep-sorted start - dontBuild = true; - dontFixup = true; - dontUnpack = true; - # keep-sorted end - - installPhase = '' - mkdir -p "$out/node_modules" - ''; - } - else - stdenvNoCC.mkDerivation { - pname = "${pname}-deps"; - inherit version src; - - nativeBuildInputs = [bun]; - - # keep-sorted start - dontBuild = true; - dontFixup = true; - # keep-sorted end - - installPhase = '' - export HOME="$TMPDIR" - - ${dependencyInstallCommand} - - mkdir -p "$out" - cp -r node_modules "$out/" - ''; - - outputHash = dependencyHash; - outputHashAlgo = "sha256"; - outputHashMode = "recursive"; - }; - in - stdenvNoCC.mkDerivation ( - (removeAttrs args [ - # keep-sorted start - "buildCommand" - "dependencyHash" - "dependencyInstallCommand" - "meta" - # keep-sorted end - ]) - // { - nativeBuildInputs = [bun] ++ (args.nativeBuildInputs or []); - dontBuild = true; - - installPhase = '' - runHook preInstall - - cp -r ${deps}/node_modules ./node_modules - - runHook preBuild - ${lib.optionalString (buildCommand != null) buildCommand} - runHook postBuild - - mkdir -p "$out" - cp -r . "$out/" - - cd "$out" - - runHook postInstall - ''; - - meta = - meta - // { - # keep-sorted start - description = meta.description or ""; - platforms = meta.platforms or platforms.unix; - # keep-sorted end - }; - } - ); - - call = name: callPackage (root + "/${name}") {inherit mkOpencodePlugin;}; -in - pipe root [ - readDir - (filterAttrs (_: type: type == "directory")) - (mapAttrs (name: _: call name)) - ] - // { - inherit mkOpencodePlugin; - } diff --git a/pkgs/opencode/plugins/dynamic-context-pruning/default.nix b/pkgs/opencode/plugins/dynamic-context-pruning/default.nix deleted file mode 100644 index 820d938..0000000 --- a/pkgs/opencode/plugins/dynamic-context-pruning/default.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ - # keep-sorted start - fetchFromGitHub, - lib, - mkOpencodePlugin, - typescript, - # keep-sorted end -}: -mkOpencodePlugin rec { - pname = "dynamic-context-pruning"; - version = "3.1.14"; - - src = fetchFromGitHub { - owner = "Opencode-DCP"; - repo = "opencode-${pname}"; - rev = "v${version}"; - hash = "sha256-MABdjzmoULt+mYEkH01Lo1FfdZciQ4mlI/CLWS3qTmI="; - }; - - dependencyHash = "sha256-C0Us4cFtLJxnRVA4onVFgoARTjYlFbstjXt5KNqMFEc="; - - nativeBuildInputs = [typescript]; - - buildCommand = "tsc -p tsconfig.json"; - - meta = { - # keep-sorted start - description = "OpenCode plugin for dynamic context pruning and token usage optimization"; - homepage = "https://github.com/Opencode-DCP/opencode-dynamic-context-pruning"; - license = lib.licenses.agpl3Plus; - # keep-sorted end - }; -} diff --git a/pkgs/opencode/plugins/ignore/default.nix b/pkgs/opencode/plugins/ignore/default.nix deleted file mode 100644 index 6b55daf..0000000 --- a/pkgs/opencode/plugins/ignore/default.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ - # keep-sorted start - fetchFromGitHub, - lib, - mkOpencodePlugin, - # keep-sorted end -}: -mkOpencodePlugin rec { - pname = "ignore"; - version = "1.1.0"; - - src = fetchFromGitHub { - owner = "lgladysz"; - repo = "opencode-${pname}"; - rev = "v${version}"; - hash = "sha256-jqUG0zyYRheAGa+UjZy7twySTXgUzbB+5MK7svis3ss="; - }; - - dependencyHash = "sha256-mqg1Zx4ps51yESFRlvfQFRzO25ndLVnf59fRo15K4ig="; - - buildCommand = "bun run build"; - - meta = { - # keep-sorted start - description = "OpenCode plugin to restrict AI access to files and directories using .ignore patterns"; - homepage = "https://github.com/lgladysz/opencode-ignore"; - license = lib.licenses.mit; - # keep-sorted end - }; -} diff --git a/pkgs/opencode/plugins/lazy-mcp/default.nix b/pkgs/opencode/plugins/lazy-mcp/default.nix deleted file mode 100644 index 00b32d8..0000000 --- a/pkgs/opencode/plugins/lazy-mcp/default.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ - # keep-sorted start - fetchFromGitHub, - lib, - mkOpencodePlugin, - # keep-sorted end -}: -mkOpencodePlugin rec { - pname = "lazy-mcp"; - version = "1.0.3-unstable-2026-03-24"; - - src = fetchFromGitHub { - owner = "orionpax1997"; - repo = "opencode-${pname}"; - rev = "d0ea57186d07f945269fd06b0bd4b281c0c88d79"; - hash = "sha256-O2kk30Nx6jeHO7xesOs/5bCd/izK/rjE1gkutd6Is1M="; - }; - - dependencyHash = "sha256-+HAmAO4dJREPtY7I3g7mNu9ehAsWsTa+OWGb8qiN+KE="; - - buildCommand = "bun build src/index.ts --outfile dist/index.js --target node --format esm"; - - meta = { - # keep-sorted start - description = "OpenCode plugin for skill-embedded MCP support with lazy loading"; - homepage = "https://github.com/orionpax1997/opencode-lazy-mcp"; - license = lib.licenses.mit; - # keep-sorted end - }; -} diff --git a/pkgs/opencode/plugins/notifier/default.nix b/pkgs/opencode/plugins/notifier/default.nix deleted file mode 100644 index ed1ba58..0000000 --- a/pkgs/opencode/plugins/notifier/default.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ - # keep-sorted start - fetchFromGitHub, - lib, - mkOpencodePlugin, - # keep-sorted end -}: -mkOpencodePlugin rec { - pname = "notifier"; - version = "0.2.8"; - - src = fetchFromGitHub { - owner = "mohak34"; - repo = "opencode-${pname}"; - rev = "v${version}"; - hash = "sha256-c9+RY0D0lyk2pjNZaWxS9KGBtHK7efUKyLcKYBDxBWc="; - }; - - dependencyHash = "sha256-wk4j4raaEgdu2NQtCRRbXOyBDq4ZteRkJwGdgwKZSaI="; - - buildCommand = "bun run build"; - - meta = { - # keep-sorted start - description = "OpenCode plugin for desktop notifications and sounds on permission, completion, and error events"; - homepage = "https://github.com/mohak34/opencode-notifier"; - license = lib.licenses.mit; - # keep-sorted end - }; -} diff --git a/pkgs/opencode/plugins/quota/default.nix b/pkgs/opencode/plugins/quota/default.nix deleted file mode 100644 index de59af5..0000000 --- a/pkgs/opencode/plugins/quota/default.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ - # keep-sorted start - fetchFromGitHub, - lib, - mkOpencodePlugin, - nodejs, - typescript, - # keep-sorted end -}: -mkOpencodePlugin rec { - pname = "quota"; - version = "3.11.2-unstable-2026-07-10"; - - src = fetchFromGitHub { - owner = "slkiser"; - repo = "opencode-${pname}"; - rev = "0bfd8993960332bc5437c1e0952f1b498d2b03ca"; - hash = "sha256-NQT5yuMykiheKqt74nk7AM3QTBuwdFWTSd2o/UKSAQo="; - }; - - dependencyHash = "sha256-+RblTKXPMU58SPTAsnPY3yDqjPlIysHTP8WNHMMKwIk="; - dependencyInstallCommand = "BUN_CONFIG_SKIP_SAVE_LOCKFILE=1 bun install --no-cache --ignore-scripts"; - - nativeBuildInputs = [ - nodejs - typescript - ]; - - buildCommand = "tsc && node scripts/copy-data.mjs && node scripts/prepare-tui-dist.mjs"; - - meta = { - # keep-sorted start - description = "OpenCode plugin for quota, usage, and token visibility."; - homepage = "https://github.com/slkiser/opencode-quota"; - license = lib.licenses.mit; - # keep-sorted end - }; -} diff --git a/pkgs/opencode/plugins/unmoji/default.nix b/pkgs/opencode/plugins/unmoji/default.nix deleted file mode 100644 index bd55139..0000000 --- a/pkgs/opencode/plugins/unmoji/default.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ - # keep-sorted start - fetchFromCodeberg, - lib, - mkOpencodePlugin, - # keep-sorted end -}: -mkOpencodePlugin rec { - pname = "unmoji"; - version = "0.3.12"; - - src = fetchFromCodeberg { - owner = "bastiangx"; - repo = "opencode-${pname}"; - rev = version; - hash = "sha256-yL+e83vEEmtElRVdC9uIweFQ4CqtwqLUtitYRi7ncNc="; - }; - - dependencyHash = "sha256-mx5l95k3saYu7WYF7YDGziFZX9+YzZwk+UrogK1xlcQ="; - - buildCommand = "bun build src/index.ts --outdir dist --target node --format esm"; - - meta = { - # keep-sorted start - description = "OpenCode plugin that strips emojis from agent outputs in Opencode"; - homepage = "https://codeberg.org/bastiangx/opencode-unmoji"; - license = lib.licenses.mit; - # keep-sorted end - }; -} diff --git a/pkgs/tangled-mcp/default.nix b/pkgs/tangled-mcp/default.nix new file mode 100644 index 0000000..4461fd4 --- /dev/null +++ b/pkgs/tangled-mcp/default.nix @@ -0,0 +1,48 @@ +{ + # keep-sorted start + fetchgit, + lib, + python3Packages, + # keep-sorted end +}: +python3Packages.buildPythonApplication rec { + pname = "tangled-mcp"; + version = "0.0.14"; + pyproject = true; + + src = fetchgit { + url = "https://tangled.org/zzstoatzz.io/tangled-mcp"; + tag = "v${version}"; + hash = "sha256-6yXDNdnKvvJ5OiROsIEaiTWEQ+dG15AZ5WyI0cAbERQ="; + }; + + build-system = with python3Packages; [ + # keep-sorted start + hatchling + uv-dynamic-versioning + # keep-sorted end + ]; + + dependencies = with python3Packages; [ + # keep-sorted start + atproto + fastmcp + httpx + pydantic-settings + python-dotenv + websockets + # keep-sorted end + ]; + + pythonImportsCheck = ["tangled_mcp"]; + + meta = with lib; { + # keep-sorted start + description = "MCP server for the Tangled git collaboration platform"; + homepage = "https://tangled.org/zzstoatzz.io/tangled-mcp"; + license = licenses.unfree; + mainProgram = "tangled-mcp"; + platforms = platforms.unix; + # keep-sorted end + }; +} -- 2.51.2