mirror of
https://github.com/srid/nixos-config.git
synced 2026-07-16 22:01:33 +08:00
Add opencode home-manager module for zest and pureintent (#103)
* Add opencode home-manager module for zest and pureintent * Move claude-code Juspay config to separate module * Add JUSPAY_API_KEY export for opencode
This commit is contained in:
parent
cea0595d60
commit
f13b2406c6
10 changed files with 231 additions and 28 deletions
|
|
@ -10,6 +10,7 @@ in
|
|||
flake.inputs.self.homeModules.darwin-only
|
||||
"${homeMod}/gui/1password.nix"
|
||||
"${homeMod}/claude-code"
|
||||
"${homeMod}/opencode"
|
||||
|
||||
"${homeMod}/work/juspay.nix"
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ in
|
|||
home-manager.sharedModules = [
|
||||
"${homeMod}/work/juspay.nix"
|
||||
"${homeMod}/services/vira.nix"
|
||||
"${homeMod}/opencode"
|
||||
|
||||
# "${homeMod}/services/dropbox.nix"
|
||||
# "${homeMod}/services/obsidian.nix"
|
||||
|
|
|
|||
|
|
@ -3,12 +3,10 @@ let
|
|||
inherit (flake.inputs) AI;
|
||||
in
|
||||
{
|
||||
# Import the general home-manager module
|
||||
imports = [
|
||||
"${AI}/nix/home-manager-module.nix"
|
||||
];
|
||||
|
||||
# Packages often used by Claude Code CLI
|
||||
home.packages = with pkgs; [
|
||||
tree
|
||||
];
|
||||
|
|
@ -16,10 +14,8 @@ in
|
|||
programs.claude-code = {
|
||||
enable = true;
|
||||
|
||||
# Use sandboxed version
|
||||
package = flake.inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.claude; # see claude-sandboxed.nix
|
||||
package = flake.inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.claude;
|
||||
|
||||
# Set the claude-code directory for auto-wiring
|
||||
autoWire.dir = AI;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
24
modules/home/claude-code/juspay.nix
Normal file
24
modules/home/claude-code/juspay.nix
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{ flake, config, ... }:
|
||||
let
|
||||
inherit (flake) self;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
../agenix.nix
|
||||
];
|
||||
|
||||
home.sessionVariables = {
|
||||
ANTHROPIC_BASE_URL = "https://grid.ai.juspay.net";
|
||||
ANTHROPIC_MODEL = "claude-sonnet-4-5";
|
||||
CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS = "1";
|
||||
};
|
||||
|
||||
age.secrets.juspay-anthropic-api-key.file = self + /secrets/juspay-anthropic-api-key.age;
|
||||
|
||||
programs.zsh.initContent = ''
|
||||
export ANTHROPIC_API_KEY="$(cat "${config.age.secrets.juspay-anthropic-api-key.path}")"
|
||||
'';
|
||||
programs.bash.initExtra = ''
|
||||
export ANTHROPIC_API_KEY="$(cat "${config.age.secrets.juspay-anthropic-api-key.path}")"
|
||||
'';
|
||||
}
|
||||
32
modules/home/opencode/default.nix
Normal file
32
modules/home/opencode/default.nix
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
{ pkgs, ... }:
|
||||
let
|
||||
juspayProvider = import ./juspay;
|
||||
in
|
||||
{
|
||||
programs.opencode = {
|
||||
enable = true;
|
||||
package = pkgs.opencode;
|
||||
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 = [ ];
|
||||
};
|
||||
};
|
||||
}
|
||||
9
modules/home/opencode/juspay.nix
Normal file
9
modules/home/opencode/juspay.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{ 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}")"
|
||||
'';
|
||||
}
|
||||
13
modules/home/opencode/juspay/default.nix
Normal file
13
modules/home/opencode/juspay/default.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
let
|
||||
models = import ./models.nix;
|
||||
in
|
||||
{
|
||||
npm = "@ai-sdk/openai-compatible";
|
||||
name = "Juspay";
|
||||
options = {
|
||||
baseURL = "https://grid.ai.juspay.net";
|
||||
apiKey = "{env:JUSPAY_API_KEY}";
|
||||
timeout = 600000;
|
||||
};
|
||||
inherit models;
|
||||
}
|
||||
145
modules/home/opencode/juspay/models.nix
Normal file
145
modules/home/opencode/juspay/models.nix
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
{
|
||||
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;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
# Juspay-specific configuration using the work jump host module
|
||||
|
||||
|
||||
{ flake, config, ... }:
|
||||
{ flake, ... }:
|
||||
let
|
||||
inherit (flake) self;
|
||||
inherit (flake.inputs) jumphost-nix;
|
||||
homeMod = flake.inputs.self + /modules/home;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
"${jumphost-nix}/module.nix"
|
||||
../agenix.nix
|
||||
"${homeMod}/claude-code/juspay.nix"
|
||||
"${homeMod}/opencode/juspay.nix"
|
||||
];
|
||||
|
||||
# https://github.com/srid/jumphost-nix
|
||||
programs.jumphost = {
|
||||
enable = true;
|
||||
host = "vanjaram.tail12b27.ts.net";
|
||||
|
|
@ -31,25 +31,6 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
# For Juspay LiteLLM AI configuration
|
||||
home.sessionVariables = {
|
||||
# ANTHROPIC_API_KEY set in initExtra via agenix (see below)
|
||||
ANTHROPIC_BASE_URL = "https://grid.ai.juspay.net";
|
||||
ANTHROPIC_MODEL = "claude-sonnet-4-5";
|
||||
CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS = "1"; # For GLM related bug
|
||||
};
|
||||
age = {
|
||||
secrets = {
|
||||
juspay-anthropic-api-key.file = self + /secrets/juspay-anthropic-api-key.age;
|
||||
};
|
||||
};
|
||||
programs.zsh.initContent = ''
|
||||
export ANTHROPIC_API_KEY="$(cat "${config.age.secrets.juspay-anthropic-api-key.path}")"
|
||||
'';
|
||||
programs.bash.initExtra = ''
|
||||
export ANTHROPIC_API_KEY="$(cat "${config.age.secrets.juspay-anthropic-api-key.path}")"
|
||||
'';
|
||||
|
||||
home.shellAliases = {
|
||||
jcurl = "curl --socks5 localhost:1080";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -36,4 +36,5 @@ packageOverlays // {
|
|||
# Use claude-code from nix-ai-tools instead of nixpkgs
|
||||
claude-code = (nix-ai-tools self.system).claude-code;
|
||||
copilot-cli = (nix-ai-tools self.system).copilot-cli;
|
||||
opencode = (nix-ai-tools self.system).opencode;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue