Skip to content

Commit 0159a06

Browse files
committed
models: Added default provider setting
1 parent 343d2ce commit 0159a06

File tree

3 files changed

+37
-25
lines changed

3 files changed

+37
-25
lines changed

riglets/models.nix

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
_:
2-
{ lib, ... }:
2+
{ lib, config, ... }:
3+
with lib.types;
34
let
4-
providerAndModel = with lib.types; {
5-
providerId = lib.mkOption {
6-
type = nullOr str;
7-
description = "Model provider ID. Can be ignored depending on the entrypoint";
8-
default = null;
9-
};
10-
modelId = lib.mkOption {
11-
type = nullOr str;
12-
description = "Model ID";
13-
default = null;
14-
};
5+
cfg = config.models;
6+
7+
providerId = lib.mkOption {
8+
type = nullOr str;
9+
description = "Model provider ID. Can be ignored depending on the entrypoint";
10+
default = cfg.providers.default;
11+
};
12+
13+
modelId = lib.mkOption {
14+
type = nullOr str;
15+
description = "Model ID";
16+
default = null;
17+
};
18+
19+
providerAndModel = {
20+
inherit providerId modelId;
1521
};
1622
in
1723
{
18-
options.models = with lib.types; {
24+
options.models = {
1925
default = providerAndModel;
2026

2127
specialized = lib.mkOption {
@@ -25,14 +31,20 @@ in
2531
};
2632

2733
providers = {
34+
default = lib.mkOption {
35+
type = nullOr str;
36+
description = "Default model provider to use";
37+
default = null;
38+
};
39+
2840
disabled = lib.mkOption {
2941
description = "Prevent these providers from being used";
3042
type = nullOr (listOf str);
31-
default = null;
43+
default = [ ];
3244
};
3345

3446
enabled = lib.mkOption {
35-
description = "Only allow these providers to be used";
47+
description = "Only allow these providers to be used. Allow all if null";
3648
type = nullOr (listOf str);
3749
default = null;
3850
};

riglets/opencode.nix

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,18 +113,16 @@ in
113113
}
114114
// lib.optionalAttrs cmd.useSubAgent { subtask = true; }
115115
) (lib.concatMapAttrs (k: v: { "rig:${k}" = v; }) rig.promptCommands);
116-
}
117-
// lib.optionalAttrs (config.models.default.modelId != null) {
118-
model = toModelId config.models.default;
119-
}
120-
// lib.optionalAttrs (config.models.providers.disabled != null) {
116+
117+
agent = lib.mapAttrs (_agentName: mdl: { model = toModelId mdl; }) config.models.specialized;
118+
121119
disabled_providers = config.models.providers.disabled;
122120
}
123121
// lib.optionalAttrs (config.models.providers.enabled != null) {
124122
enabled_providers = config.models.providers.enabled;
125123
}
126-
// lib.optionalAttrs (config.models.specialized != { }) {
127-
agent = lib.mapAttrs (_agentName: mdl: { model = toModelId mdl; }) config.models.specialized;
124+
// lib.optionalAttrs (config.models.default.modelId != null) {
125+
model = toModelId config.models.default;
128126
}
129127
);
130128
in

rigup.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,11 @@ extends.self = "example-rig-claude"
6060
[rigs.example-rig-opencode]
6161
extends.self = "example-rig"
6262
riglets.self = ["opencode"]
63-
config.models.default = { providerId = "opencode", modelId = "glm-4.7" }
64-
config.models.specialized.plan = { providerId = "opencode", modelId = "claude-opus-4-6" }
65-
config.models.specialized.explore = { providerId = "opencode", modelId = "kimi-k2.5-free" }
63+
config.models.providers.default = "opencode"
64+
config.models.providers.enabled = ["opencode"]
65+
config.models.default.modelId = "glm-4.7"
66+
config.models.specialized.plan.modelId = "claude-opus-4-6"
67+
config.models.specialized.explore.modelId = "kimi-k2.5-free"
6668

6769
[rigs.example-rig-opencode.config.agent.personality]
6870
inspiration = "Fa Mulan"

0 commit comments

Comments
 (0)