146 lines
5.0 KiB
Nix
146 lines
5.0 KiB
Nix
{ pkgs, ... }:
|
|
let
|
|
languages = import ./_languages.nix { inherit pkgs; };
|
|
providers = import ./_providers.nix;
|
|
skills = import ./_skills.nix { inherit pkgs; };
|
|
|
|
inherit (pkgs) opencode;
|
|
|
|
opencodeEnv = pkgs.buildEnv {
|
|
name = "opencode-env";
|
|
paths = languages.packages ++ skills.packages;
|
|
};
|
|
opencodeInitScript = pkgs.writeShellScript "opencode-init" ''
|
|
mkdir -p "$HOME/.local/cache/opencode/node_modules/@opencode-ai"
|
|
mkdir -p "$HOME/.config/opencode/node_modules/@opencode-ai"
|
|
if [ -d "$HOME/.config/opencode/node_modules/@opencode-ai/plugin" ]; then
|
|
if [ ! -L "$HOME/.local/cache/opencode/node_modules/@opencode-ai/plugin" ]; then
|
|
ln -sf "$HOME/.config/opencode/node_modules/@opencode-ai/plugin" \
|
|
"$HOME/.local/cache/opencode/node_modules/@opencode-ai/plugin"
|
|
fi
|
|
fi
|
|
exec ${opencode}/bin/opencode "$@"
|
|
'';
|
|
opencodeWrapped =
|
|
pkgs.runCommand "opencode-wrapped" {
|
|
buildInputs = [ pkgs.makeWrapper ];
|
|
} ''
|
|
mkdir -p $out/bin
|
|
makeWrapper ${opencodeInitScript} $out/bin/opencode \
|
|
--prefix PATH : ${opencodeEnv}/bin \
|
|
--prefix LD_LIBRARY_PATH : "${pkgs.lib.makeLibraryPath [pkgs.stdenv.cc.cc.lib]}"
|
|
'';
|
|
configFile = "opencode/config.json";
|
|
tuiFile = "opencode/tui.json";
|
|
in {
|
|
users.users.someone.packages = [
|
|
opencodeWrapped
|
|
];
|
|
xdg.configFile = {
|
|
"${configFile}".text = builtins.toJSON {
|
|
"$schema" = "https://opencode.ai/config.json";
|
|
plugin = [
|
|
"opencode-antigravity-auth@latest"
|
|
"@tarquinen/opencode-dcp@latest"
|
|
"oh-my-openagent@latest"
|
|
];
|
|
model = "google/antigravity-gemini-3-flash";
|
|
small_model = "opencode/big-pickle";
|
|
autoupdate = false;
|
|
agent = {
|
|
build = { model = "opencode/nemotron-3-super-free"; };
|
|
plan = { model = "opencode/big-pickle"; };
|
|
task = { model = "opencode/nemotron-3-super-free"; };
|
|
"sisyphus-junior" = { model = "opencode/nemotron-3-super-free"; };
|
|
explore = { model = "opencode/minimax-m2.5-free"; };
|
|
general = { model = "opencode/big-pickle"; };
|
|
oracle = { model = "opencode/nemotron-3-super-free"; };
|
|
"ultrabrain" = { model = "opencode/nemotron-3-super-free"; };
|
|
"deep" = { model = "opencode/nemotron-3-super-free"; };
|
|
"quick" = { model = "opencode/gpt-5-nano"; };
|
|
"artistry" = { model = "opencode/nemotron-3-super-free"; };
|
|
"visual-engineering" = { model = "opencode/hy3-preview-free"; };
|
|
"writing" = { model = "opencode/hy3-preview-free"; };
|
|
};
|
|
share = "disabled";
|
|
disabled_providers = [
|
|
"amazon-bedrock"
|
|
"anthropic"
|
|
"azure-openai"
|
|
"azure-cognitive-services"
|
|
"baseten"
|
|
"cerebras"
|
|
"cloudflare-ai-gateway"
|
|
"cortecs"
|
|
"deep-infra"
|
|
"fireworks-ai"
|
|
"google-vertex-ai"
|
|
"groq"
|
|
"hugging-face"
|
|
"helicone"
|
|
"llama.cpp"
|
|
"io-net"
|
|
"lmstudio"
|
|
"moonshot-ai"
|
|
"nebius-token-factory"
|
|
"ollama"
|
|
"ollama-cloud"
|
|
"openai"
|
|
"sap-ai-core"
|
|
"ovhcloud-ai-endpoints"
|
|
"together-ai"
|
|
"venice-ai"
|
|
"xai"
|
|
"zai"
|
|
"zenmux"
|
|
];
|
|
enabled_providers = [ "opencode" "google" "openrouter" ];
|
|
mcp = {
|
|
gh_grep = {
|
|
type = "remote";
|
|
url = "https://mcp.grep.app/";
|
|
enabled = true;
|
|
timeout = 10000;
|
|
};
|
|
deepwiki = {
|
|
type = "remote";
|
|
url = "https://mcp.deepwiki.com/mcp";
|
|
enabled = true;
|
|
timeout = 10000;
|
|
};
|
|
context7 = {
|
|
type = "remote";
|
|
url = "https://mcp.context7.com/mcp";
|
|
enabled = true;
|
|
timeout = 10000;
|
|
};
|
|
};
|
|
inherit (languages) formatter lsp;
|
|
provider = providers.config;
|
|
};
|
|
|
|
"opencode/oh-my-openagent.json".text = builtins.toJSON {
|
|
"$schema" = "https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/master/assets/oh-my-opencode.schema.json";
|
|
agents = {
|
|
"sisyphus-junior" = { model = "opencode/nemotron-3-super-free"; };
|
|
};
|
|
categories = {
|
|
"quick" = { model = "opencode/gpt-5-nano"; };
|
|
"ultrabrain" = { model = "opencode/nemotron-3-super-free"; };
|
|
"deep" = { model = "opencode/nemotron-3-super-free"; };
|
|
"visual-engineering" = { model = "opencode/hy3-preview-free"; };
|
|
"writing" = { model = "opencode/hy3-preview-free"; };
|
|
"unspecified-low" = { model = "opencode/gpt-5-nano"; };
|
|
"unspecified-high" = { model = "opencode/nemotron-3-super-free"; };
|
|
};
|
|
};
|
|
|
|
"${tuiFile}".text = builtins.toJSON {
|
|
"$schema" = "https://opencode.ai/tui.json";
|
|
theme = "gruvbox";
|
|
};
|
|
|
|
"opencode/skill".source = skills.skillsSource + "/skill";
|
|
};
|
|
}
|