File tree Expand file tree Collapse file tree 3 files changed +10
-20
lines changed
Expand file tree Collapse file tree 3 files changed +10
-20
lines changed Original file line number Diff line number Diff line change 1919 );
2020 };
2121
22- # Override a derivation so its always built locally, and not queried from remote substituters
22+ # Override a derivation so it is always built locally, and not queried from remote substituters
2323 alwaysLocal =
2424 x:
2525 if pkgs.lib.isDerivation x then
Original file line number Diff line number Diff line change 11_:
2- { lib, ... }:
2+ { lib, riglib, ... }:
33{
44 options.models = with lib.types; {
5- default = {
6- providerId = lib.mkOption {
7- type = nullOr str;
8- description = "Model provider ID. Can be ignored depending on the entrypoint";
9- default = null;
10- };
11- modelId = lib.mkOption {
12- type = nullOr str;
13- description = "Model ID";
14- default = null;
15- };
16- };
5+ default = riglib.providerAndModel;
176
187 providers = {
198 disabled = lib.mkOption {
3120 };
3221
3322 config.riglets.models.meta = {
34- description = "Pre-select a specific model for a rig (to be imported by compatible entrypoints)";
23+ description = "Pre-select default model for a rig (to be imported by compatible entrypoints)";
3524 status = "stable";
3625 version = "0.1.0";
3726 intent = "base";
Original file line number Diff line number Diff line change 3232 let
3333 manifestPath = rig.manifest.override { shownDocRoot = "$RIG_DOCS"; };
3434
35+ toModelId = x: "${x.providerId}/${x.modelId}";
36+
3537 # OpenCode config with permissions and MCP servers
3638 opencodeConfigJson = riglib.toJSON (
3739 {
112114 If models.default.modelId is set, then models.default.providerId must be too
113115 ''
114116 else
115- "${ config.models.default.providerId}/${config.models.default.modelId}" ;
117+ toModelId config.models.default;
116118 }
117119 // lib.optionalAttrs (config.models.providers.disabled != null) {
118120 disabled_providers = config.models.providers.disabled;
119121 }
120122 // lib.optionalAttrs (config.models.providers.enabled != null) {
121123 enabled_providers = config.models.providers.enabled;
122124 }
125+ // lib.optionalAttrs (config.models.specialized != { }) {
126+ agent = lib.mapAttrs (_agentName: toModelId) config.models.specialized;
127+ }
123128 );
124129 in
125130 # Return a folder derivation with bin/ subfolder
126131 pkgs.writeShellScriptBin "opencode" ''
127132 set -euo pipefail
128133
129- warn() {
130- printf "\033[0;33m%s\n\033[0m" "$1" >&2
131- }
132-
133134 export PATH="${rig.toolRoot}/bin:$PATH"
134135 export RIG_DOCS="${rig.docRoot}"
135136 # Exported for convenience
You can’t perform that action at this time.
0 commit comments