Add personal opencode config
This commit is contained in:
@@ -18,5 +18,7 @@
|
|||||||
dot.llm = {
|
dot.llm = {
|
||||||
enable = true;
|
enable = true;
|
||||||
gemini-cli.enable = true;
|
gemini-cli.enable = true;
|
||||||
|
opencode.enable = true;
|
||||||
|
opencode.enableConfig = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ in
|
|||||||
default = false;
|
default = false;
|
||||||
description = "Enable managed OpenCode configuration";
|
description = "Enable managed OpenCode configuration";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
workMode = lib.mkEnableOption "work-specific opencode configuration";
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enableConfig {
|
config = lib.mkIf cfg.enableConfig {
|
||||||
@@ -20,50 +22,65 @@ in
|
|||||||
|
|
||||||
# Create the OpenCode config.json template with secret substitution
|
# Create the OpenCode config.json template with secret substitution
|
||||||
sops.templates."opencode/opencode.json" = {
|
sops.templates."opencode/opencode.json" = {
|
||||||
content = builtins.toJSON {
|
content = builtins.toJSON (let
|
||||||
"$schema" = "https://opencode.ai/config.json";
|
baseConfig = {
|
||||||
model = "anthropic/claude-sonnet-4-5-20250929";
|
"$schema" = "https://opencode.ai/config.json";
|
||||||
small_model = "anthropic/claude-haiku-4-5-20251001";
|
default_agent = "plan";
|
||||||
default_agent = "plan";
|
};
|
||||||
enabled_providers = [ "anthropic" "langdock-openai" "ollama" ];
|
|
||||||
provider = {
|
workConfig = {
|
||||||
langdock-openai = {
|
enabled_providers = [ "anthropic" "langdock-openai" "ollama" ];
|
||||||
npm = "@ai-sdk/openai-compatible";
|
model = "anthropic/claude-opus-4-6-default";
|
||||||
name = "Langdock OpenAI";
|
small_model = "anthropic/claude-haiku-4-5-20251001";
|
||||||
options = {
|
provider = {
|
||||||
baseURL = "https://api.langdock.com/openai/eu/v1";
|
langdock-openai = {
|
||||||
apiKey = config.sops.placeholder.langdock_api_key;
|
npm = "@ai-sdk/openai-compatible";
|
||||||
|
name = "Langdock OpenAI";
|
||||||
|
options = {
|
||||||
|
baseURL = "https://api.langdock.com/openai/eu/v1";
|
||||||
|
apiKey = config.sops.placeholder.langdock_api_key;
|
||||||
|
};
|
||||||
|
models = {
|
||||||
|
"gpt-5.2" = { name = "GPT-5.2"; };
|
||||||
|
"gpt-5-mini" = { name = "GPT-5 mini"; };
|
||||||
|
};
|
||||||
};
|
};
|
||||||
models = {
|
anthropic = {
|
||||||
"gpt-5.2" = { name = "GPT-5.2"; };
|
options = {
|
||||||
"gpt-5-mini" = { name = "GPT-5 mini"; };
|
baseURL = "https://api.langdock.com/anthropic/eu/v1";
|
||||||
|
apiKey = config.sops.placeholder.langdock_api_key;
|
||||||
|
};
|
||||||
|
models = {
|
||||||
|
"claude-opus-4-6-default" = { name = "Opus 4.6"; };
|
||||||
|
"claude-sonnet-4-5-20250929" = { name = "Sonnet 4.5"; };
|
||||||
|
"claude-haiku-4-5-20251001" = { name = "Haiku 4.5"; };
|
||||||
|
};
|
||||||
|
whitelist = [ "claude-opus-4-6-default" "claude-sonnet-4-5-20250929" "claude-haiku-4-5-20251001"];
|
||||||
};
|
};
|
||||||
};
|
ollama = {
|
||||||
anthropic = {
|
npm = "@ai-sdk/openai-compatible";
|
||||||
options = {
|
name = "Ollama (Local)";
|
||||||
baseURL = "https://api.langdock.com/anthropic/eu/v1";
|
options = {
|
||||||
apiKey = config.sops.placeholder.langdock_api_key;
|
baseURL = "http://192.168.11.23:11434/v1";
|
||||||
};
|
};
|
||||||
models = {
|
models = {
|
||||||
"claude-opus-4-6-default" = { name = "Opus 4.6"; };
|
"qwen3-coder:30b" = { name = "Qwen 3 Coder 30B"; };
|
||||||
"claude-sonnet-4-5-20250929" = { name = "Sonnet 4.5"; };
|
"codellama:34b-instruct" = { name = "CodeLlama 34B Instruct"; };
|
||||||
"claude-haiku-4-5-20251001" = { name = "Haiku 4.5"; };
|
};
|
||||||
};
|
|
||||||
whitelist = [ "claude-opus-4-6-default" "claude-sonnet-4-5-20250929" "claude-haiku-4-5-20251001"];
|
|
||||||
};
|
|
||||||
ollama = {
|
|
||||||
npm = "@ai-sdk/openai-compatible";
|
|
||||||
name = "Ollama (Local)";
|
|
||||||
options = {
|
|
||||||
baseURL = "http://192.168.11.23:11434/v1";
|
|
||||||
};
|
|
||||||
models = {
|
|
||||||
"qwen3-coder:30b" = { name = "Qwen 3 Coder 30B"; };
|
|
||||||
"codellama:34b-instruct" = { name = "CodeLlama 34B Instruct"; };
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
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
|
# Link the generated config to the expected location
|
||||||
|
|||||||
Reference in New Issue
Block a user