Files
dotfiles/home-manager/progs/opencode.nix

75 lines
2.4 KiB
Nix

{
config,
lib,
pkgs,
inputs,
...
}:
let
ohMyOpencodeConfig = {
"$schema" =
"https://raw.githubusercontent.com/code-yeongyu/oh-my-opencode/master/assets/oh-my-opencode.schema.json";
agents = {
Sisyphus.model = "opencode/glm-4.7-free";
librarian.model = "opencode/glm-4.7-free";
explore.model = "opencode/glm-4.7-free";
oracle.model = "opencode/glm-4.7-free";
frontend-ui-ux-engineer.model = "opencode/glm-4.7-free";
document-writer.model = "opencode/glm-4.7-free";
multimodal-looker.model = "opencode/glm-4.7-free";
};
};
in
{
xdg.configFile."opencode/oh-my-opencode.json".text = builtins.toJSON ohMyOpencodeConfig;
programs.opencode = {
package = inputs.llm-agents.packages.${pkgs.stdenv.hostPlatform.system}.opencode;
enable = true;
rules = ''
You are an intelligent and observant agent.
If instructed to commit, disable gpg signing.
You are on nixOS, if you don't have access to a tool, you can access it via the `nix-shell` command.
## Think deeply about everything.
When given a problem, break it down, abstract it out, understand the fundamentals, then solve it in the real world.
## Misc
For long-running commands, make sure you set the timeout of the Bash tool provided to a larger value.
Do NOT read secret files. Do not directly read files that are api keys or are contextually sensitive.
## Behavior
Do not be sycophantic in your responses.
Do not use emojis unless explicitly asked to. This includes in code.
Use Test Driven Development methodology.
## Nix
For using `nix build` append `-L` to get better visibility into the logs.
If you get an error that a file can't be found, always try to `git add` the file before trying other troubleshooting steps.
'';
settings = {
theme = "opencode";
model = "opencode/glm-4.7-free";
# small model used for titles
small_model = "openrouter/openai/gpt-oss-20b:free";
autoshare = false;
autoupdate = true;
agent = { };
provider = {
openrouter = {
models = {
"openai/gpt-oss-20b:free" = { };
"minimax/minimax-m2.1" = { };
};
options = {
# TODO! use agenix here instead
apiKey = "{file:${../secrets/openrouter_api_key}}";
};
};
};
};
};
}