После feat(essentials): enable programs.nix-ld, bun-runtime plugin install
прошёл дальше preflight — теперь падает на следующем шаге: «herdr web ui
needs Node 18 or newer for its terminal sidecar, and 'node' is not on the
PATH of the shell that started herdr».
preflight.sh плагина проверяет `node --version` на PATH. На sapphira
node уже был через opencode.nix home.packages (там же, где раньше был
bun — мы его оттуда убрали в прошлом рефакторе). На rydiwo opencode
не подключён, и node отсутствовал.
Добавляю pkgs.nodejs_22 в home.modules.herdr-runtime.nix — это тот же
пакет, что используется в opencode.nix (consistency, один major). На
sapphira он уже был через opencode; home.packages мерджит и дедуплицирует,
так что лишней копии не будет.
Раньше bun для пользовательского shell PATH приходил двумя путями:
на sapphira — через opencode.nix:339 (home.packages=[... pkgs.bun ...]),
на rydiwo — добавлен вручную в home/secondary.nix (commit ffd85dc) для
herdr-web-ui plugin'а, который без bun в PATH скачивает generic-linux
runtime и ломается о NixOS dynamic linker.
Теперь:
• home/modules/herdr-runtime.nix — единый источник pkgs.bun для
пользовательского PATH (импортируется и в server.nix, и в
secondary.nix).
• home/secondary.nix — добавлен импорт herdr-runtime.nix, убран
прямой home.packages = with pkgs; [ bun ]; и его 10-строчный
комментарий-объяснение (переехал в herdr-runtime.nix).
• home/server.nix — добавлен импорт herdr-runtime.nix.
• home/modules/opencode.nix — pkgs.bun удалён из home.packages
(он теперь из herdr-runtime.nix), но ОСТАВЛЕН в
programs.opencode.extraPackages (line 271) — это другой PATH
(--suffix PATH внутри opencode-wrapped env), не дубликат.
Результат для обоих хостов:
- shell PATH: bun из /nix/store/...-bun-*/bin/bun
- opencode-wrapped env (только sapphira): bun через extraPackages
- herdr-web-ui plugin auto-install на rydiwo: находит bun в PATH,
не скачивает generic-linux runtime
После этого оба хоста пересобираются (sapphira: opencode/server.nix;
rydiwo: secondary.nix + новый модуль).
Per-UID design of herdr (Unix sockets, no HTTP) drove the home-manager
choice over a NixOS module — mirrors the existing opencode-web pattern.
- home/modules/herdr.nix: new systemd user service running
herdr 0.9.3 on sapphira, --session herdr-prod,
EnvironmentFile from sops opencode_server. 2G/4G cgroup caps,
Restart=always (mitigates herdr#4920).
- modules/server/nginx.nix: herdr.zeroq.su vhost with Authelia
forward-auth (wildcard *.zeroq.su policy already covers it).
Upstream 127.0.0.1:7317 is the Bun server from the
devswha/herdr-web-ui plugin (970star, MIT) — vhost 502s until
'herdr plugin install devswha/herdr-web-ui' runs.
- modules/server/coredns.nix: 192.168.1.20 herdr.zeroq.su A record.
- home/server.nix: import the new module.
Reverts the plugin registration added in 4ff7188 ("opencode:
opencode-loop added"). The entry had to be dropped from both places
inside programs.opencode, otherwise the plugin keeps loading in the
TUI:
settings.plugin -> ~/.config/opencode/opencode.json
tui.plugin -> ~/.config/opencode/tui.json
oh-my-openagent is untouched; its agent and category overrides in
~/.omo/omo.jsonc still apply.
Three small things together:
1. relinkHomeManager was pinning the versioned symlink name to
'home-manager-24-link'. That breaks on every HM major-version bump:
HM 25 will move the alias to 'home-manager-25-link' and the script
will silently stop relinking. Derive the name from one hop of the
stable 'home-manager' symlink, with a guard against the missing case
so a fallback never accidentally rewrites the profiles/ directory
itself.
2. programs.opencode.web.environmentFile now reads from
xlib.dirs.opencode-server-env (added previously in users.nix + dirs.nix).
The sops materialization and the systemd EnvironmentFile can no
longer silently desync.
3. Document the oh-my-openagent 2026-07-opencode-config-unification
migration trap that logs 'Migration backup path already exists' on
every startup: the backup path embeds the content-hashed store path,
which stays valid in /nix/store across HM activations, so the
deterministic collision never resolves itself. Recovery is
'rm -rf ~/.omo/migration-backup-*' to let omo retry; if it keeps
failing on the same path the plugin version probably expects a new
schema and this file needs changes.
Also trim the over-explained [Service] / serviceConfig comment: the
home-manager attrset-union behavior is general, not specific to this
unit, so the explanation got shorter without losing the invariant.