Created
February 7, 2026 08:55
-
-
Save jason9075/a435a7d0cbc9032d7ed6c3364bec3e6c to your computer and use it in GitHub Desktop.
put this file in ~/.config/opencode/plugins
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import fs from 'fs'; | |
| export const NixDevelopPlugin = async ({ directory, client }) => { | |
| return { | |
| "tool.execute.before": async (input, output) => { | |
| if (input.tool === "bash") { | |
| const flakePath = `${directory}/flake.nix`; | |
| if (fs.existsSync(flakePath)) { | |
| const originalCommand = output.args.command; | |
| if (!originalCommand.includes("nix develop")) { | |
| output.args.command = `nix develop --command ${originalCommand}`; | |
| } | |
| } | |
| } | |
| }, | |
| }; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment