Add personal opencode config

This commit is contained in:
Martin Pander
2026-02-13 17:24:58 +01:00
parent 80fb31ffe1
commit 228fb04814
2 changed files with 58 additions and 39 deletions

View File

@@ -18,5 +18,7 @@
dot.llm = {
enable = true;
gemini-cli.enable = true;
opencode.enable = true;
opencode.enableConfig = true;
};
}

View File

@@ -10,6 +10,8 @@ in
default = false;
description = "Enable managed OpenCode configuration";
};
workMode = lib.mkEnableOption "work-specific opencode configuration";
};
config = lib.mkIf cfg.enableConfig {
@@ -20,12 +22,16 @@ in
# Create the OpenCode config.json template with secret substitution
sops.templates."opencode/opencode.json" = {
content = builtins.toJSON {
content = builtins.toJSON (let
baseConfig = {
"$schema" = "https://opencode.ai/config.json";
model = "anthropic/claude-sonnet-4-5-20250929";
small_model = "anthropic/claude-haiku-4-5-20251001";
default_agent = "plan";
};
workConfig = {
enabled_providers = [ "anthropic" "langdock-openai" "ollama" ];
model = "anthropic/claude-opus-4-6-default";
small_model = "anthropic/claude-haiku-4-5-20251001";
provider = {
langdock-openai = {
npm = "@ai-sdk/openai-compatible";
@@ -64,6 +70,17 @@ in
};
};
};
personalConfig = {
plugin = [ "opencode-gemini-auth@latest" ];
model = "google/gemini-3-pro-preview";
small_model = "google/gemini-3-flash-preview";
enabled_providers = [ "google" ];
};
in
# Merge base config with the selected mode config
baseConfig // (if cfg.workMode then workConfig else personalConfig)
);
};
# Link the generated config to the expected location