mirror of
https://github.com/srid/nixos-config.git
synced 2026-07-16 22:01:33 +08:00
opencode: use upstream juspay/oc home module (#105)
This commit is contained in:
parent
26e12b1662
commit
667543ceca
11 changed files with 154 additions and 298 deletions
|
|
@ -17,7 +17,7 @@
|
|||
# "nixos-hardware"
|
||||
"nix-index-database"
|
||||
"nixvim"
|
||||
"nix-ai-tools"
|
||||
"oc"
|
||||
"AI"
|
||||
];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,43 +1,12 @@
|
|||
{ flake, lib, pkgs, ... }:
|
||||
let
|
||||
inherit (flake.inputs) AI;
|
||||
juspayProvider = import ./juspay;
|
||||
|
||||
commandsDir = AI + "/commands";
|
||||
autoCommands = if builtins.pathExists commandsDir then
|
||||
lib.mapAttrs'
|
||||
(fileName: _: lib.nameValuePair
|
||||
(lib.removeSuffix ".md" fileName)
|
||||
(commandsDir + "/${fileName}"))
|
||||
(builtins.readDir commandsDir)
|
||||
else { };
|
||||
in
|
||||
{ config, flake, pkgs, ... }:
|
||||
{
|
||||
programs.opencode = {
|
||||
enable = true;
|
||||
package = pkgs.opencode;
|
||||
commands = autoCommands;
|
||||
settings = {
|
||||
model = "litellm/glm-latest";
|
||||
# Explore agent for fast codebase search/reading tasks
|
||||
agent = {
|
||||
explore = {
|
||||
mode = "subagent";
|
||||
model = "litellm/open-fast";
|
||||
};
|
||||
};
|
||||
autoupdate = true;
|
||||
provider = {
|
||||
litellm = juspayProvider;
|
||||
};
|
||||
mcp = {
|
||||
deepwiki = {
|
||||
type = "remote";
|
||||
url = "https://mcp.deepwiki.com/mcp";
|
||||
enabled = true;
|
||||
};
|
||||
};
|
||||
plugin = [ ];
|
||||
};
|
||||
};
|
||||
imports = [ flake.inputs.oc.homeModules.default ];
|
||||
programs.opencode.package = flake.inputs.oc.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
||||
|
||||
programs.zsh.initContent = ''
|
||||
export JUSPAY_API_KEY="$(cat "${config.age.secrets.juspay-anthropic-api-key.path}")"
|
||||
'';
|
||||
programs.bash.initExtra = ''
|
||||
export JUSPAY_API_KEY="$(cat "${config.age.secrets.juspay-anthropic-api-key.path}")"
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
{ config, ... }:
|
||||
{
|
||||
programs.zsh.initContent = ''
|
||||
export JUSPAY_API_KEY="$(cat "${config.age.secrets.juspay-anthropic-api-key.path}")"
|
||||
'';
|
||||
programs.bash.initExtra = ''
|
||||
export JUSPAY_API_KEY="$(cat "${config.age.secrets.juspay-anthropic-api-key.path}")"
|
||||
'';
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
let
|
||||
models = import ./models.nix;
|
||||
in
|
||||
{
|
||||
npm = "@ai-sdk/openai-compatible";
|
||||
name = "Juspay";
|
||||
options = {
|
||||
baseURL = "https://grid.ai.juspay.net";
|
||||
# HACK: hardcoded path to agenix secret. Should use XDG_RUNTIME_DIR but
|
||||
# OpenCode's {file:...} doesn't support environment variable expansion.
|
||||
apiKey = "{file:/run/user/1000/agenix/juspay-anthropic-api-key}";
|
||||
timeout = 600000;
|
||||
};
|
||||
inherit models;
|
||||
}
|
||||
|
|
@ -1,145 +0,0 @@
|
|||
{
|
||||
open-large = {
|
||||
name = "open-large";
|
||||
modalities = {
|
||||
input = [ "text" "image" ];
|
||||
output = [ "text" ];
|
||||
};
|
||||
limit = {
|
||||
context = 202752;
|
||||
output = 32000;
|
||||
};
|
||||
};
|
||||
open-fast = {
|
||||
name = "open-fast";
|
||||
modalities = {
|
||||
input = [ "text" "image" ];
|
||||
output = [ "text" ];
|
||||
};
|
||||
limit = {
|
||||
context = 196000;
|
||||
output = 32000;
|
||||
};
|
||||
};
|
||||
open-vision = {
|
||||
name = "open-vision";
|
||||
modalities = {
|
||||
input = [ "text" "image" ];
|
||||
output = [ "text" ];
|
||||
};
|
||||
limit = {
|
||||
context = 262144;
|
||||
output = 32000;
|
||||
};
|
||||
};
|
||||
claude-opus-4-5 = {
|
||||
name = "claude-opus-4-5";
|
||||
modalities = {
|
||||
input = [ "text" "image" ];
|
||||
output = [ "text" ];
|
||||
};
|
||||
limit = {
|
||||
context = 1000000;
|
||||
output = 128000;
|
||||
};
|
||||
};
|
||||
claude-opus-4-6 = {
|
||||
name = "claude-opus-4-6";
|
||||
modalities = {
|
||||
input = [ "text" "image" ];
|
||||
output = [ "text" ];
|
||||
};
|
||||
limit = {
|
||||
context = 1000000;
|
||||
output = 128000;
|
||||
};
|
||||
};
|
||||
claude-sonnet-4-6 = {
|
||||
name = "claude-sonnet-4-6";
|
||||
modalities = {
|
||||
input = [ "text" "image" ];
|
||||
output = [ "text" ];
|
||||
};
|
||||
limit = {
|
||||
context = 200000;
|
||||
output = 64000;
|
||||
};
|
||||
};
|
||||
claude-sonnet-4-5 = {
|
||||
name = "claude-sonnet-4-5";
|
||||
modalities = {
|
||||
input = [ "text" "image" ];
|
||||
output = [ "text" ];
|
||||
};
|
||||
limit = {
|
||||
context = 200000;
|
||||
output = 32000;
|
||||
};
|
||||
};
|
||||
glm-flash-experimental = {
|
||||
name = "glm-flash-experimental";
|
||||
modalities = {
|
||||
input = [ "text" "image" ];
|
||||
output = [ "text" ];
|
||||
};
|
||||
limit = {
|
||||
context = 262144;
|
||||
output = 32000;
|
||||
};
|
||||
};
|
||||
gemini-3-pro-preview = {
|
||||
name = "gemini-3-pro-preview";
|
||||
modalities = {
|
||||
input = [ "text" "image" ];
|
||||
output = [ "text" ];
|
||||
};
|
||||
limit = {
|
||||
context = 1048576;
|
||||
output = 65535;
|
||||
};
|
||||
};
|
||||
gemini-3-flash-preview = {
|
||||
name = "gemini-3-flash-preview";
|
||||
modalities = {
|
||||
input = [ "text" "image" ];
|
||||
output = [ "text" ];
|
||||
};
|
||||
limit = {
|
||||
context = 1048576;
|
||||
output = 65535;
|
||||
};
|
||||
};
|
||||
minimax-m2 = {
|
||||
name = "minimax-m2";
|
||||
modalities = {
|
||||
input = [ "text" "image" ];
|
||||
output = [ "text" ];
|
||||
};
|
||||
limit = {
|
||||
context = 202752;
|
||||
output = 32000;
|
||||
};
|
||||
};
|
||||
glm-latest = {
|
||||
name = "glm-latest";
|
||||
modalities = {
|
||||
input = [ "text" "image" ];
|
||||
output = [ "text" ];
|
||||
};
|
||||
limit = {
|
||||
context = 202752;
|
||||
output = 32000;
|
||||
};
|
||||
};
|
||||
kimi-latest = {
|
||||
name = "kimi-latest";
|
||||
modalities = {
|
||||
input = [ "text" "image" ];
|
||||
output = [ "text" ];
|
||||
};
|
||||
limit = {
|
||||
context = 262000;
|
||||
output = 32000;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -10,7 +10,7 @@ in
|
|||
imports = [
|
||||
"${jumphost-nix}/module.nix"
|
||||
"${homeMod}/claude-code/juspay.nix"
|
||||
"${homeMod}/opencode/juspay.nix"
|
||||
"${homeMod}/opencode"
|
||||
];
|
||||
|
||||
programs.jumphost = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue