opencode: use Juspay config via upstream home module

Consume juspay/AI's homeModules.opencode (config only, not the package) on
both zest and pureintent, install the opencode binary from nixpkgs, and
export JUSPAY_API_KEY from the agenix secret into interactive shells.
This commit is contained in:
Sridhar Ratnakumar 2026-06-21 16:59:29 -04:00
parent 1f5fc411ca
commit 7ee4b8800e
5 changed files with 67 additions and 0 deletions

View file

@ -0,0 +1,35 @@
# Juspay's opencode *configuration* (not the package), via the home-manager
# module exposed upstream by juspay/AI (homeModules.opencode).
#
# The config points opencode at Juspay's LLM gateway and authenticates with
# JUSPAY_API_KEY, which we source from the agenix-managed secret and export
# into interactive shells below.
{ flake, pkgs, config, ... }:
let
homeMod = flake.inputs.self + /modules/home;
in
{
imports = [
flake.inputs.juspay-ai.homeModules.opencode
"${homeMod}/agenix.nix"
];
programs.opencode-juspay.enable = true;
# The upstream module is config-only by design; install the binary from
# nixpkgs so the Juspay config above is usable out of the box.
home.packages = [ pkgs.opencode ];
# The Juspay litellm provider authenticates with JUSPAY_API_KEY at runtime.
# Decrypt the secret via agenix and export it into interactive shells.
age.secrets.juspay-anthropic-api-key.file =
flake.inputs.self + /secrets/juspay-anthropic-api-key.age;
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}")"
'';
}