Files
nixos-config/home/features/coding/opencode.nix
2026-01-17 10:17:48 +01:00

326 lines
9.4 KiB
Nix

{inputs, ...}: {
xdg.configFile = {
"opencode/command" = {
source = "${inputs.agents}/command";
recursive = true;
};
"opencode/context" = {
source = "${inputs.agents}/context";
recursive = true;
};
"opencode/prompts" = {
source = "${inputs.agents}/prompts";
recursive = true;
};
"opencode/skill" = {
source = "${inputs.agents}/skill";
recursive = true;
};
};
programs.opencode = {
enable = true;
settings = {
theme = "opencode";
plugin = ["oh-my-opencode" "opencode-beads" "opencode-antigravity-auth@beta"];
agent =
builtins.fromJSON
(builtins.readFile "${inputs.agents}/agent/agents.json");
formatter = {
alejandra = {
command = ["alejandra" "-q" "-"];
extensions = [".nix"];
};
};
mcp = {
Ref = {
type = "local";
command = [
"sh"
"-c"
"REF_API_KEY=$(cat /run/agenix/ref-key) exec bunx ref-tools-mcp@latest"
];
enabled = true;
};
Anytype = {
type = "local";
command = [
"sh"
"-c"
"OPENAPI_MCP_HEADERS=$(cat /run/agenix/anytype-key) exec bunx @anyproto/anytype-mcp"
];
enabled = false;
};
Basecamp = {
type = "local";
command = [
"/home/m3tam3re/p/PYTHON/Basecamp-MCP-Server/venv/bin/python"
"/home/m3tam3re/p/PYTHON/Basecamp-MCP-Server/basecamp_fastmcp.py"
];
environment = {
PYTHONPATH = "/home/m3tam3re/p/PYTHON/Basecamp-MCP-Server";
VIRTUAL_ENV = "/home/m3tam3re/p/PYTHON/Basecamp-MCP-Server/venv";
BASECAMP_ACCOUNT_ID = "5996442";
};
enabled = false;
};
Exa = {
type = "local";
command = [
"sh"
"-c"
"EXA_API_KEY=$(cat /run/agenix/exa-key) exec bunx exa-mcp-server@latest tools=web_search_exa"
];
enabled = true;
};
};
provider = {
google = {
models = {
antigravity-gemini-3-pro = {
name = "Gemini 3 Pro (Antigravity)";
limit = {
context = 1048576;
output = 65535;
};
modalities = {
input = ["text" "image" "pdf"];
output = ["text"];
};
variants = {
low = {thinkingLevel = "low";};
high = {thinkingLevel = "high";};
};
};
antigravity-gemini-3-flash = {
name = "Gemini 3 Flash (Antigravity)";
limit = {
context = 1048576;
output = 65536;
};
modalities = {
input = ["text" "image" "pdf"];
output = ["text"];
};
variants = {
minimal = {thinkingLevel = "minimal";};
low = {thinkingLevel = "low";};
medium = {thinkingLevel = "medium";};
high = {thinkingLevel = "high";};
};
};
antigravity-claude-sonnet-4-5 = {
name = "Claude Sonnet 4.5 (Antigravity)";
limit = {
context = 200000;
output = 64000;
};
modalities = {
input = ["text" "image" "pdf"];
output = ["text"];
};
};
antigravity-claude-sonnet-4-5-thinking = {
name = "Claude Sonnet 4.5 Thinking (Antigravity)";
limit = {
context = 200000;
output = 64000;
};
modalities = {
input = ["text" "image" "pdf"];
output = ["text"];
};
variants = {
low = {thinkingConfig = {thinkingBudget = 8192;};};
max = {thinkingConfig = {thinkingBudget = 32768;};};
};
};
antigravity-claude-opus-4-5-thinking = {
name = "Claude Opus 4.5 Thinking (Antigravity)";
limit = {
context = 200000;
output = 64000;
};
modalities = {
input = ["text" "image" "pdf"];
output = ["text"];
};
variants = {
low = {thinkingConfig = {thinkingBudget = 8192;};};
max = {thinkingConfig = {thinkingBudget = 32768;};};
};
};
"gemini-2.5-flash" = {
name = "Gemini 2.5 Flash (Gemini CLI)";
limit = {
context = 1048576;
output = 65536;
};
modalities = {
input = ["text" "image" "pdf"];
output = ["text"];
};
};
"gemini-2.5-pro" = {
name = "Gemini 2.5 Pro (Gemini CLI)";
limit = {
context = 1048576;
output = 65536;
};
modalities = {
input = ["text" "image" "pdf"];
output = ["text"];
};
};
"gemini-3-flash-preview" = {
name = "Gemini 3 Flash Preview (Gemini CLI)";
limit = {
context = 1048576;
output = 65536;
};
modalities = {
input = ["text" "image" "pdf"];
output = ["text"];
};
};
"gemini-3-pro-preview" = {
name = "Gemini 3 Pro Preview (Gemini CLI)";
limit = {
context = 1048576;
output = 65535;
};
modalities = {
input = ["text" "image" "pdf"];
output = ["text"];
};
};
};
};
};
};
};
home.file.".config/opencode/oh-my-opencode.json".text = builtins.toJSON {
"$schema" = "https://raw.githubusercontent.com/code-yeongyu/oh-my-opencode/master/assets/oh-my-opencode.schema.json";
google_auth = false;
agents = {
Sisyphus = {
model = "google/antigravity-claude-opus-4-5-thinking";
permission = {
edit = "allow";
bash = {
"*" = "allow";
"rm *" = "ask";
"rmdir *" = "ask";
"mv *" = "ask";
"chmod *" = "ask";
"chown *" = "ask";
"git *" = "ask";
"git status*" = "allow";
"git log*" = "allow";
"git diff*" = "allow";
"git branch*" = "allow";
"git show*" = "allow";
"git stash list*" = "allow";
"git remote -v" = "allow";
"git add *" = "allow";
"git commit *" = "allow";
"jj *" = "ask";
"jj status" = "allow";
"jj log*" = "allow";
"jj diff*" = "allow";
"jj show*" = "allow";
"npm *" = "ask";
"npx *" = "ask";
"bun *" = "ask";
"bunx *" = "ask";
"uv *" = "ask";
"pip *" = "ask";
"pip3 *" = "ask";
"yarn *" = "ask";
"pnpm *" = "ask";
"cargo *" = "ask";
"go *" = "ask";
"make *" = "ask";
"dd *" = "deny";
"mkfs*" = "deny";
"fdisk *" = "deny";
"parted *" = "deny";
"eval *" = "deny";
"source *" = "deny";
"curl *|*sh" = "deny";
"wget *|*sh" = "deny";
"sudo *" = "deny";
"su *" = "deny";
"systemctl *" = "deny";
"service *" = "deny";
"shutdown *" = "deny";
"reboot*" = "deny";
"init *" = "deny";
"> /dev/*" = "deny";
"cat * > /dev/*" = "deny";
};
external_directory = "ask";
doom_loop = "ask";
};
};
librarian = {
model = "opencode/glm-4.7-free";
permission = {
edit = "deny";
bash = "deny";
};
};
explore = {
model = "opencode/glm-4.7-free";
permission = {
edit = "deny";
bash = "deny";
};
};
oracle = {
model = "opencode/glm-4.7-free";
permission = {
edit = "deny";
bash = "deny";
};
};
frontend-ui-ux-engineer = {
model = "opencode/glm-4.7-free";
permission = {
edit = "allow";
bash = {
"*" = "ask";
"npm *" = "ask";
"npx *" = "ask";
"bun *" = "ask";
"bunx *" = "ask";
"rm *" = "ask";
"mv *" = "ask";
"dd *" = "deny";
"mkfs*" = "deny";
"sudo *" = "deny";
"curl *|*sh" = "deny";
"wget *|*sh" = "deny";
};
};
};
document-writer = {
model = "opencode/glm-4.7-free";
permission = {
edit = "allow";
bash = "deny";
};
};
multimodal-looker = {
model = "opencode/glm-4.7-free";
permission = {
edit = "deny";
bash = "deny";
};
};
};
disabled_mcps = ["context7" "websearch"];
};
}