feat(agents): add Qwen Code and use OpenCode V2 as opencode

Expose llm-agents' opencode2 package under the normal opencode command and persist Qwen Code's ~/.qwen state on the ephemeral-root hosts.
This commit is contained in:
Ryan Yin committed 2026-11-04 00:15:43 +08:00
1 parent 99b0208a2a
commit 432de26764
9 files changed
+33 -7

No files matched your search

+6 -6
View File
@@ -13,12 +13,12 @@ Markdown with no Nix dependency; this module only wires it into place.
- `skills.nix`: links the global skills into `~/.agents/skills/<name>`, from pinned flake inputs and
from `agents/skills/`; the inventory is
[agents/skills/README.md](../../../../agents/skills/README.md).
- `packages.nix`: agent CLIs (`codex`, `opencode2`, `pi`) from the `llm-agents` flake input, dsh
from `nur-ryan4yin`, `pkgs.ctx7` for the `find-docs` skill, and `pkgs.mcp-grafana` for the Grafana
MCP server. dsh's Nushell-only shell is selected when the package is built, via `dsh.withPlugins`
with the plugin from the `dsh-nu` flake input, so it is a derivation choice rather than runtime
state; profile patches live in `~/.dsh/profiles/<name>/cordis.patch.yml`. See [dsh.md](./dsh.md)
for the layer order and the settings that bite.
- `packages.nix`: agent CLIs (`codex`, `opencode`, `qwen-code`, `pi`) from the `llm-agents` flake
input, dsh from `nur-ryan4yin`, `pkgs.ctx7` for the `find-docs` skill, and `pkgs.mcp-grafana` for
the Grafana MCP server. dsh's Nushell-only shell is selected when the package is built, via
`dsh.withPlugins` with the plugin from the `dsh-nu` flake input, so it is a derivation choice
rather than runtime state; profile patches live in `~/.dsh/profiles/<name>/cordis.patch.yml`. See
[dsh.md](./dsh.md) for the layer order and the settings that bite.
- `env.nix`: telemetry and auto-update opt-outs for the agents.
## Deployed rule targets
+10 -1
View File
@@ -12,12 +12,21 @@ let
inherit pkgs;
inherit (pkgs) dsh;
};
# llm-agents.nix still exposes OpenCode V2 as `opencode2` so it can coexist
# with the v1 package. Re-expose its binary under the normal command name.
opencode = pkgs.linkFarm "opencode" [
{
name = "bin/opencode";
path = "${agentPackages.opencode2}/bin/opencode2";
}
];
in
{
home.packages = [
# Agents
agentPackages.codex
agentPackages.opencode2
opencode
agentPackages.qwen-code
agentPackages.pi
# dsh from nur-packages: llm-agents.nix's dsh cannot boot on nixpkgs node
# (node-addon-require-builtin probe), this one shims it. The Nushell-only
+6
View File
@@ -178,6 +178,12 @@ in
".codex"
".dsh" # DeepSeek Harness
".pi"
# Qwen Code keeps settings, credentials, history, sessions, and logs
# under ~/.qwen; keep the whole directory private and persistent.
{
directory = ".qwen";
mode = "0700";
}
".config/opencode"
".local/share/opencode"
".local/state/opencode"
+6
View File
@@ -100,6 +100,12 @@ in
".codex"
".dsh" # DeepSeek Harness
".pi"
# Qwen Code keeps settings, credentials, history, sessions, and logs
# under ~/.qwen; keep the whole directory private and persistent.
{
directory = ".qwen";
mode = "0700";
}
".config/opencode"
".local/share/opencode"
".local/state/opencode"
@@ -2,6 +2,7 @@
let
common = {
agentsFromHome = true;
qwenInstalled = true;
devToolsFromHome = true;
nushellSecrets = false;
nixLd = true;
@@ -23,6 +23,7 @@ lib.genAttrs hosts (
{
# home role: home/linux/tui.nix
agentsFromHome = hasPackage "codex" home.home.packages;
qwenInstalled = hasPackage "qwen-code" home.home.packages;
devToolsFromHome = hasPackage "kubectl" home.home.packages;
# ~/.secrets is synced to the desktops only; sourcing it would break nushell.
nushellSecrets = home.modules.shell.secrets.enable;
@@ -19,4 +19,5 @@
wivrnImportsOpenXRToSteam = true;
wivrnStatePreserved = true;
adbStatePreserved = true;
qwenStatePreserved = true;
}
@@ -54,4 +54,5 @@ in
cfg.environment.sessionVariables.PRESSURE_VESSEL_IMPORT_OPENXR_1_RUNTIMES == "1";
wivrnStatePreserved = privatelyPreserved ".config/wivrn";
adbStatePreserved = privatelyPreserved ".android";
qwenStatePreserved = privatelyPreserved ".qwen";
}
@@ -102,6 +102,7 @@ in
".local/state/home-manager"
".local/state/nix/profiles"
".codex"
".qwen"
".config/opencode"
];
pythonInstalled = builtins.any (