|
32 | 32 | let |
33 | 33 | manifestPath = rig.manifest.override { shownDocRoot = "$RIG_DOCS"; }; |
34 | 34 |
|
| 35 | + toModelId = |
| 36 | + x: |
| 37 | + if x.modelId != null && x.providerId == null then |
| 38 | + throw '' |
| 39 | + If modelId is set, then providerId must be set too |
| 40 | + '' |
| 41 | + else |
| 42 | + "${x.providerId}/${x.modelId}"; |
| 43 | + |
35 | 44 | # OpenCode config with permissions and MCP servers |
36 | 45 | opencodeConfigJson = riglib.toJSON ( |
37 | 46 | { |
|
106 | 115 | ) (lib.concatMapAttrs (k: v: { "rig:${k}" = v; }) rig.promptCommands); |
107 | 116 | } |
108 | 117 | // lib.optionalAttrs (config.models.default.modelId != null) { |
109 | | - model = |
110 | | - if config.models.default.providerId == null then |
111 | | - throw '' |
112 | | - If models.default.modelId is set, then models.default.providerId must be too |
113 | | - '' |
114 | | - else |
115 | | - "${config.models.default.providerId}/${config.models.default.modelId}"; |
| 118 | + model = toModelId config.models.default; |
116 | 119 | } |
117 | 120 | // lib.optionalAttrs (config.models.providers.disabled != null) { |
118 | 121 | disabled_providers = config.models.providers.disabled; |
119 | 122 | } |
120 | 123 | // lib.optionalAttrs (config.models.providers.enabled != null) { |
121 | 124 | enabled_providers = config.models.providers.enabled; |
122 | 125 | } |
| 126 | + // lib.optionalAttrs (config.models.specialized != { }) { |
| 127 | + agent = lib.mapAttrs (_agentName: mdl: { model = toModelId mdl; }) config.models.specialized; |
| 128 | + } |
123 | 129 | ); |
124 | 130 | in |
125 | 131 | # Return a folder derivation with bin/ subfolder |
126 | 132 | pkgs.writeShellScriptBin "opencode" '' |
127 | 133 | set -euo pipefail |
128 | 134 |
|
129 | | - warn() { |
130 | | - printf "\033[0;33m%s\n\033[0m" "$1" >&2 |
131 | | - } |
132 | | -
|
133 | 135 | export PATH="${rig.toolRoot}/bin:$PATH" |
134 | 136 | export RIG_DOCS="${rig.docRoot}" |
135 | 137 | # Exported for convenience |
|
0 commit comments