Add opencode config
This commit is contained in:
11
flake.lock
generated
11
flake.lock
generated
@@ -143,16 +143,17 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1770657009,
|
"lastModified": 1768814715,
|
||||||
"narHash": "sha256-v/LA5ZSJ+JQYzMSKB4sySM0wKfsAqddNzzxLLnbsV/E=",
|
"narHash": "sha256-uTvoxG2KuWQsIaVbvzkEQB276IxVZYrV+UeALXnIyp8=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "NixOS-WSL",
|
"repo": "nixos-wsl",
|
||||||
"rev": "5b50ea1aaa14945d4794c80fcc99c4aa1db84d2d",
|
"rev": "a14126746cee49ba450b9c7e0dc024128e094009",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "NixOS-WSL",
|
"ref": "release-25.05",
|
||||||
|
"repo": "nixos-wsl",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
nixpkgs-wsl-stable.url = "github:nixos/nixpkgs/nixos-25.05";
|
nixpkgs-wsl-stable.url = "github:nixos/nixpkgs/nixos-25.05";
|
||||||
|
|
||||||
nixos-wsl = {
|
nixos-wsl = {
|
||||||
url = "github:nix-community/NixOS-WSL";
|
url = "github:nix-community/nixos-wsl/release-25.05";
|
||||||
inputs.nixpkgs.follows = "nixpkgs-wsl-stable";
|
inputs.nixpkgs.follows = "nixpkgs-wsl-stable";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
enable = true;
|
enable = true;
|
||||||
claude-code.enable = true;
|
claude-code.enable = true;
|
||||||
opencode.enable = true;
|
opencode.enable = true;
|
||||||
|
opencode.enableConfig = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
dot.tmux.workMode = true;
|
dot.tmux.workMode = true;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
./dev.nix
|
./dev.nix
|
||||||
./nvim.nix
|
./nvim.nix
|
||||||
./task.nix
|
./task.nix
|
||||||
|
./opencode.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
|||||||
68
modules/home/opencode.nix
Normal file
68
modules/home/opencode.nix
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
{ config, lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.dot.llm.opencode;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.dot.llm.opencode = {
|
||||||
|
enableConfig = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Enable managed OpenCode configuration with sops-nix secrets";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enableConfig {
|
||||||
|
# Declare the sops secret
|
||||||
|
sops.secrets.langdock-api-key = {
|
||||||
|
# Uses defaultSopsFile from secrets.nix
|
||||||
|
};
|
||||||
|
|
||||||
|
# Create the OpenCode config.json template with secret substitution
|
||||||
|
sops.templates."opencode/config.json" = {
|
||||||
|
content = builtins.toJSON {
|
||||||
|
"$schema" = "https://opencode.ai/config.json";
|
||||||
|
model = "anthropic/claude-sonnet-4-5-20250929";
|
||||||
|
small_model = "anthropic/claude-haiku-4-5-20251001";
|
||||||
|
provider = {
|
||||||
|
langdock-openai = {
|
||||||
|
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-4.1" = { name = "GPT-4.1"; };
|
||||||
|
"gpt-5-mini" = { name = "GPT-5 mini"; };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
anthropic = {
|
||||||
|
options = {
|
||||||
|
baseURL = "https://api.langdock.com/anthropic/eu/v1";
|
||||||
|
apiKey = config.sops.placeholder.langdock-api-key;
|
||||||
|
};
|
||||||
|
models = {
|
||||||
|
"Opus 4.6" = { name = "opus-4.6-default"; };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
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"; };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Link the generated config to the expected location
|
||||||
|
xdg.configFile."opencode/config.json".source = config.sops.templates."opencode/config.json".path;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -21,7 +21,9 @@ vim.api.nvim_create_autocmd('FileType', {
|
|||||||
-- require('dap-python').setup()
|
-- require('dap-python').setup()
|
||||||
-- require('dap-go').setup()
|
-- require('dap-go').setup()
|
||||||
|
|
||||||
vim.lsp.enable('ruff')
|
-- vim.lsp.enable('ruff')
|
||||||
|
-- vim.lsp.config('ty')
|
||||||
|
vim.lsp.enable('ty')
|
||||||
vim.lsp.enable('gopls')
|
vim.lsp.enable('gopls')
|
||||||
vim.lsp.enable('marksman')
|
vim.lsp.enable('marksman')
|
||||||
vim.lsp.enable('rust_analyzer')
|
vim.lsp.enable('rust_analyzer')
|
||||||
|
|||||||
Reference in New Issue
Block a user