opencode: use upstream juspay/oc home module (#105)

This commit is contained in:
Sridhar Ratnakumar 2026-03-12 18:18:51 -04:00 committed by GitHub
parent 26e12b1662
commit 667543ceca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 154 additions and 298 deletions

View file

@ -10,7 +10,6 @@ in
flake.inputs.self.homeModules.darwin-only
"${homeMod}/gui/1password.nix"
"${homeMod}/claude-code"
"${homeMod}/opencode"
"${homeMod}/work/juspay.nix"

View file

@ -19,7 +19,6 @@ in
home-manager.sharedModules = [
"${homeMod}/work/juspay.nix"
"${homeMod}/services/vira.nix"
"${homeMod}/opencode"
# "${homeMod}/services/dropbox.nix"
# "${homeMod}/services/obsidian.nix"

215
flake.lock generated
View file

@ -58,11 +58,13 @@
"blueprint": {
"inputs": {
"nixpkgs": [
"nix-ai-tools",
"oc",
"llm-agents",
"nixpkgs"
],
"systems": [
"nix-ai-tools",
"oc",
"llm-agents",
"systems"
]
},
@ -83,20 +85,24 @@
"bun2nix": {
"inputs": {
"flake-parts": [
"nix-ai-tools",
"oc",
"llm-agents",
"flake-parts"
],
"import-tree": "import-tree",
"nixpkgs": [
"nix-ai-tools",
"oc",
"llm-agents",
"nixpkgs"
],
"systems": [
"nix-ai-tools",
"oc",
"llm-agents",
"systems"
],
"treefmt-nix": [
"nix-ai-tools",
"oc",
"llm-agents",
"treefmt-nix"
]
},
@ -414,27 +420,6 @@
}
},
"flake-parts_5": {
"inputs": {
"nixpkgs-lib": [
"nix-ai-tools",
"nixpkgs"
]
},
"locked": {
"lastModified": 1772408722,
"narHash": "sha256-rHuJtdcOjK7rAHpHphUb1iCvgkU3GpfvicLMwwnfMT0=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "f20dc5d9b8027381c474144ecabc9034d6a839a3",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_6": {
"inputs": {
"nixpkgs-lib": [
"nixvim",
@ -455,7 +440,47 @@
"type": "github"
}
},
"flake-parts_6": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib_2"
},
"locked": {
"lastModified": 1772408722,
"narHash": "sha256-rHuJtdcOjK7rAHpHphUb1iCvgkU3GpfvicLMwwnfMT0=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "f20dc5d9b8027381c474144ecabc9034d6a839a3",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_7": {
"inputs": {
"nixpkgs-lib": [
"oc",
"llm-agents",
"nixpkgs"
]
},
"locked": {
"lastModified": 1772408722,
"narHash": "sha256-rHuJtdcOjK7rAHpHphUb1iCvgkU3GpfvicLMwwnfMT0=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "f20dc5d9b8027381c474144ecabc9034d6a839a3",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_8": {
"inputs": {
"nixpkgs-lib": [
"vira",
@ -818,6 +843,29 @@
"type": "github"
}
},
"llm-agents": {
"inputs": {
"blueprint": "blueprint",
"bun2nix": "bun2nix",
"flake-parts": "flake-parts_7",
"nixpkgs": "nixpkgs_5",
"systems": "systems_4",
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1773325712,
"narHash": "sha256-s83aVJRJmR2sa9otxXnefohasKuRJACZv7zDh0FHzdg=",
"owner": "numtide",
"repo": "llm-agents.nix",
"rev": "dfe7089b3cb1766cf40dccd4378f240356bcf2b2",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "llm-agents.nix",
"type": "github"
}
},
"lvar": {
"flake": false,
"locked": {
@ -851,29 +899,6 @@
"type": "github"
}
},
"nix-ai-tools": {
"inputs": {
"blueprint": "blueprint",
"bun2nix": "bun2nix",
"flake-parts": "flake-parts_5",
"nixpkgs": "nixpkgs_4",
"systems": "systems_3",
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1773241852,
"narHash": "sha256-kwETflAbufOL32E1dRkJDTgcroafwN8HZqxjAaLItJw=",
"owner": "numtide",
"repo": "llm-agents.nix",
"rev": "e21490459caf641e19cac7ad7679f1121d643e0c",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "llm-agents.nix",
"type": "github"
}
},
"nix-darwin": {
"inputs": {
"nixpkgs": [
@ -1053,6 +1078,21 @@
"type": "github"
}
},
"nixpkgs-lib_2": {
"locked": {
"lastModified": 1772328832,
"narHash": "sha256-e+/T/pmEkLP6BHhYjx6GmwP5ivonQQn0bJdH9YrRB+Q=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "c185c7a5e5dd8f9add5b2f8ebeff00888b070742",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1752900028,
@ -1086,22 +1126,6 @@
}
},
"nixpkgs_4": {
"locked": {
"lastModified": 1773110118,
"narHash": "sha256-mPAG8phMbCReKSiKAijjjd3v7uVcJOQ75gSjGJjt/Rk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e607cb5360ff1234862ac9f8839522becb853bb9",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_5": {
"locked": {
"lastModified": 1772963539,
"narHash": "sha256-9jVDGZnvCckTGdYT53d/EfznygLskyLQXYwJLKMPsZs=",
@ -1117,6 +1141,22 @@
"type": "github"
}
},
"nixpkgs_5": {
"locked": {
"lastModified": 1773201692,
"narHash": "sha256-NXrKzNMniu4Oam2kAFvqJ3GB2kAvlAFIriTAheaY8hw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b6067cc0127d4db9c26c79e4de0513e58d0c40c9",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_6": {
"locked": {
"lastModified": 1765803225,
@ -1135,11 +1175,11 @@
},
"nixvim": {
"inputs": {
"flake-parts": "flake-parts_6",
"flake-parts": "flake-parts_5",
"nixpkgs": [
"nixpkgs"
],
"systems": "systems_4"
"systems": "systems_3"
},
"locked": {
"lastModified": 1772402258,
@ -1155,6 +1195,30 @@
"type": "github"
}
},
"oc": {
"inputs": {
"flake-parts": "flake-parts_6",
"llm-agents": "llm-agents",
"nixpkgs": [
"oc",
"llm-agents",
"nixpkgs"
]
},
"locked": {
"lastModified": 1773352209,
"narHash": "sha256-c2CAdq51Bx5sRAhD3JpVVSiUqMsDbUa9yqjbmNIMbcs=",
"owner": "juspay",
"repo": "oc",
"rev": "409e89243ffe2f4b22494d60cb91b63dcfbccdbc",
"type": "github"
},
"original": {
"owner": "juspay",
"repo": "oc",
"type": "github"
}
},
"process-compose-flake": {
"locked": {
"lastModified": 1767863885,
@ -1215,14 +1279,14 @@
"imako": "imako",
"jumphost-nix": "jumphost-nix",
"landrun-nix": "landrun-nix",
"nix-ai-tools": "nix-ai-tools",
"nix-darwin": "nix-darwin",
"nix-index-database": "nix-index-database",
"nixos-hardware": "nixos-hardware",
"nixos-unified": "nixos-unified_2",
"nixos-vscode-server": "nixos-vscode-server",
"nixpkgs": "nixpkgs_5",
"nixpkgs": "nixpkgs_4",
"nixvim": "nixvim",
"oc": "oc",
"vira": "vira"
}
},
@ -1366,16 +1430,17 @@
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"nix-ai-tools",
"oc",
"llm-agents",
"nixpkgs"
]
},
"locked": {
"lastModified": 1772660329,
"narHash": "sha256-IjU1FxYqm+VDe5qIOxoW+pISBlGvVApRjiw/Y/ttJzY=",
"lastModified": 1773297127,
"narHash": "sha256-6E/yhXP7Oy/NbXtf1ktzmU8SdVqJQ09HC/48ebEGBpk=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "3710e0e1218041bbad640352a0440114b1e10428",
"rev": "71b125cd05fbfd78cab3e070b73544abe24c5016",
"type": "github"
},
"original": {
@ -1421,7 +1486,7 @@
"inputs": {
"co-log-effectful": "co-log-effectful",
"devour-flake": "devour-flake",
"flake-parts": "flake-parts_7",
"flake-parts": "flake-parts_8",
"fourmolu-nix": "fourmolu-nix_3",
"git-hooks": "git-hooks_5",
"haskell-flake": "haskell-flake_3",

View file

@ -31,8 +31,7 @@
nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
# vira.url = "github:juspay/vira/github";
vira.url = "github:juspay/vira";
nix-ai-tools.url = "github:numtide/llm-agents.nix";
# nix-ai-tools.inputs.nixpkgs.follows = "nixpkgs";
oc.url = "github:juspay/oc";
# landrun-nix.url = "github:srid/landrun-nix";
landrun-nix.url = "github:adrian-gierakowski/landrun-nix/darwin-implementation-via-sandbox-exec";
AI.url = "path:vendor/AI";

View file

@ -17,7 +17,7 @@
# "nixos-hardware"
"nix-index-database"
"nixvim"
"nix-ai-tools"
"oc"
"AI"
];
};

View file

@ -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}")"
'';
}

View file

@ -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}")"
'';
}

View file

@ -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;
}

View file

@ -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;
};
};
}

View file

@ -10,7 +10,7 @@ in
imports = [
"${jumphost-nix}/module.nix"
"${homeMod}/claude-code/juspay.nix"
"${homeMod}/opencode/juspay.nix"
"${homeMod}/opencode"
];
programs.jumphost = {

View file

@ -4,7 +4,6 @@ let
inherit (flake) inputs;
inherit (inputs) self;
packages = self + /packages;
nix-ai-tools = system: inputs.nix-ai-tools.packages.${system};
in
self: super:
@ -32,9 +31,4 @@ let
(builtins.attrValues (builtins.mapAttrs makePackage entries));
in
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;
}
packageOverlays