Files
Nix-Vibe/home-manager/modules/opencode.nix
T

81 lines
2.3 KiB
Nix

{ pkgs, ... }:
{
# mcp-nixos gives opencode + VS Code real NixOS package/option data instead of
# hallucinated package names. Only installed on x1carbon (this module is only
# imported from hosts/x1carbon), so it does not leak to other machines.
home.packages = [
pkgs.mcp-nixos
# Gitea MCP server: browse/manage Gitea repos, issues, PRs from opencode.
pkgs.gitea-mcp-server
];
xdg.configFile."opencode/opencode.json".text = builtins.toJSON {
"$schema" = "https://opencode.ai/config.json";
provider = {
# lmstudio = {
# npm = "@ai-sdk/openai-compatible";
# name = "LM Studio (local)";
# options = {
# baseURL = "http://127.0.0.1:1234/v1";
# };
# models = {
# "google/gemma-4-e4b" = {
# name = "Gemma 4 E4B (LM Studio)";
# limit = {
# context = 65536;
# output = 32768;
# };
# };
# };
# };
opencode-go = { };
};
model = "opencode-go/kimi-k2.6";
lsp = {
# nil (Nix language server, installed by nix-lsp.nix) as a custom LSP
# server so the agent gets Nix diagnostics. Formatter: nixfmt (stdin).
nil = {
command = [ "${pkgs.nil}/bin/nil" ];
extensions = [ ".nix" ];
initialization = {
nil = {
formatting = {
command = [
"nixfmt"
"-"
];
};
};
};
};
};
mcp = {
# NixOS packages/options MCP server (stdlib CLI; binary provided by
# pkgs.mcp-nixos). Use "the nix tool" to look up real package names,
# options and versions while editing flake/host configs.
nixos = {
type = "local";
command = [ "mcp-nixos" ];
enabled = true;
};
# Gitea MCP server for the self-hosted instance (gitea.edley.me).
# Token comes from the SOPS secret via $GITEA_ACCESS_TOKEN (exported in
# zsh.nix) so it is never committed to the repo.
gitea = {
type = "local";
command = [
"gitea-mcp"
"-t"
"stdio"
"-H"
"https://gitea.edley.me"
"-T"
"{env:GITEA_ACCESS_TOKEN}"
];
enabled = true;
};
};
};
}