Files
helm/home/profiles/opencode/default.nix
T
2026-02-01 23:39:21 -08:00

74 lines
1.8 KiB
Nix

{
pkgs,
lib,
inputs,
osConfig ? { },
...
}:
let
# Check if we're running on box (for box-specific config)
isBox = (osConfig.networking.hostName or "") == "box";
in
let
# Paths to agenix-decrypted secrets (same on Darwin and NixOS)
githubToken = "/run/agenix/github-token";
anthropicToken = "/run/agenix/anthropicToken";
# github-mcp-server binary path from nixpkgs
githubMcpServer = "${pkgs.github-mcp-server}/bin/github-mcp-server";
in
{
home.packages = [
pkgs.github-mcp-server
inputs.llm-agents.packages.${pkgs.system}.opencode
inputs.llm-agents.packages.${pkgs.system}.tuicr
inputs.llm-agents.packages.${pkgs.system}.chainlink
];
# OpenCode configuration directory
xdg.configFile = {
"opencode/opencode.json".text = builtins.toJSON {
"$schema" = "https://opencode.ai/config.json";
theme = "ayu-mirage";
autoupdate = false;
permission = {
external_directory = "allow";
};
provider = {
anthropic = {
options = {
apiKey = "{file:${anthropicToken}}";
};
};
};
mcp = {
github = {
type = "local";
command = [
githubMcpServer
"stdio"
];
environment = {
GITHUB_PERSONAL_ACCESS_TOKEN = "{file:${githubToken}}";
};
};
};
agent = {
build.tools."github_*" = false;
plan.tools."github_*" = false;
};
#plugin = ["@plannotator/opencode@latest"];
};
"opencode/themes".source = ./themes;
"opencode/agents".source = ./agents;
"opencode/commands".source = ./commands;
"opencode/skills".source = ./skills;
};
home.file = lib.mkIf isBox {
"usr/.opencode/agents.md".source = ./agents/box.md;
};
}