Первая редакция ADR-0011 утверждала: «на закреплённом nixpkgs nix flake check
падает на любом derivation-выводе, поэтому output'ов formatter и checks быть
не может». Перепроверка это опровергла, и ADR переписан.
Измерено (WSL, nix 2.34.9):
formatter = pkgs.hello -> error: 'outPath' is not a valid system type
formatter = hand-written derivation -> та же ошибка (nix-internal/derivation-internal.nix:50)
formatter = derivation без outPath -> error: 'drvPath' is not a valid system type
checks.x86_64-linux.hello = pkgs.hello -> all checks passed!
packages.x86_64-linux.hello = pkgs.hello -> all checks passed!
control (без derivation-выводов) -> all checks passed!
То есть:
* поломка НЕ зависит от nixpkgs — воспроизводится на флейке без инпутов;
* nix 2.34.9 при проверке вывода formatter перебирает ИМЕНА атрибутов
derivation'а и трактует каждое как системный тип (outPath -> drvPath);
* вывод checks работает нормально. В этом репозитории он уже есть
(checks.deploy-schema, checks.deploy-activate из deploy-rs) и проходит.
Выводы ADR-0011 не изменились, изменились причины:
* output'а formatter нет — по-прежнему, но из-за бага nix, а не из-за
пина nixpkgs;
* python-проверки остаются в .ci/checks.sh — теперь это ВЫБОР, а не
запрет: derivation в checks видит только закоммиченный flake source
(а не рабочее дерево, нужное pre-commit'у) и вытеснил бы проверки
deploy-rs, занявшие имя checks.
Попутно: комментарии в flake.nix и .ci/checks.sh, README и AGENTS.md приведены
в соответствие с измеренным — чтобы следующий агент не «починил» это, не
заметив, что чинить нечего.
treefmt --fail-on-change падал на файлах, которые сама эта ветка и принесла:
checks.sh, config-fingerprint.sh и runtime-drift.sh не были shfmt-чистыми.
Форматтер, который красный на собственной ветке, — не форматтер.
Сделано:
* три скрипта этой ветки отформатированы (shfmt -i 2 -ci);
* .agent/src/install.sh исключён из treefmt: он старый, 487 строк diff'а,
и переписывать чужой инсталлятор — решение владельца, не форматтера;
* shellcheck добавлен в devshell .#fmt и в checks.sh (check #13); если
shellcheck нет в PATH — проверка SKIP, а не FAIL;
* поправлены протухшие комментарии treefmt.toml: output'а formatter у
флейка нет (ADR-0011), а .ci/flake-checks.nix удалён.
Заодно в шапке config-fingerprint.sh зафиксирован грабли, который стоил
часа поиска: обе ревизии надо материализовать одинаково (git archive),
иначе исполняемый бит одного файла меняет store path whitesur-kde, а за
ним system-path, XDG_DATA_DIRS и X-Restart-Triggers — при полностью
идентичном содержимом.
config-fingerprint.sh: снимок поведенчески значимых частей конфигурации
всех хостов (юниты и их unitConfig, порты и vhost'ы nginx, зона DNS,
пакеты, монтирования, контейнеры) — чтобы «функционал не изменился»
было измеримым, а не обещанием. Значения секретов в снимок не попадают.
runtime-drift.sh: сверка декларации с работающим хостом — nginx -T против
/etc/nginx/nginx.conf, podman inspect против -p в systemd-юните, и
наличие ConditionPathIsMountPoint у охраняемых юнитов. Ловит класс
«в nix всё правильно, в проде — нет» (инвариант 8, ADR-0003/0004).
evaluate-all-hosts.yml: workflow вручную вычисляет все семь конфигураций.
Раньше CI проверял только sapphira (раннер — сам сапфир), и поломки в
mobile.nix были невидимы.
#10 check-domains.py: DNS-запись в зоне zeroq.su без nginx-vhost'а.
Известные расхождения (снятые сервисы, coturn/netdata/uptime-kuma в
архиве) вынесены в .ci/tests/known-domain-gaps.txt; новые расхождения
роняют проверку. Обратное направление (vhost без локальной записи) —
информация: публичные домены резолвятся через публичный DNS.
#11 check-listen-addrs.py: listen.addr должен называть интерфейс, а не
сеть (192.168.1.0/24 — ошибка, 100.64.0.0 — tailscale-адрес, не сеть).
Рядом self-test: проверка, которая не может упасть, — не проверка.
#12 check-agent-consistency.py: AGENTS.md, manifest.md, manifest.json и
decisions/index.json не должны противоречить друг другу. Сейчас
противоречили: в сводке AGENTS.md значилась закрытая T52 и не значились
T58/T60/T61, а manifest.md утверждал, что T38+ не внесены в JSON.
Все три — python без зависимостей, запускаются из .ci/checks.sh, который
и CI, и pre-commit вызывают одинаково.
Бандл v3.10.2 тянул ядро Xray 26.10.10, которое апстрим отозвал:
release notes v3.11.0 говорят «the pulled v26.10.10 binary pins are
replaced». Пин остаётся явным тегом (R1.5) — :latest не возвращается.
- modules/containers/3x-ui.nix: v3.10.2 -> v3.11.0, история инцидента в
комментарии сохранена и дополнена.
- .agent/decisions/0007-3x-ui-3.11.0.md: контекст, решение, последствия
(REALITY: fp in {chrome,firefox,safari}, minClientVer 1.0.0, R1.16),
риски, откат через бэкап тома db/ (миграции БД необратимы), чеклист
после rebuild. index.json: запись 0007.
- AGENTS.md, project-rules.md (R1.5/R1.8), project-state.md,
manifest.md (T43/T44), .ci/checks.sh: фактические упоминания версии и
номера строки (:62 -> :71). Хроника notes/3x-ui-xray-26.9.md не
переписана, добавлена ссылка на 0007.
- T3: premise refuted by a runtime 'nft list ruleset' on otreca - 'inet nixos-fw'
already has 'policy drop'; the hand-written 'inet filter' only rate-limits SYN
and must NOT get a drop (it would blackhole the VDS). AGENTS invariant 6 and
the traps table updated; T3-A proposal marked withdrawn. No code change.
- T38: herdr_web_token rotated (old -> 401, new -> 200); literal removed from
manifest.json (token -> secret_ref). Old token in git history is now invalid.
- T20: completed (100755, bash invocation, .gitea workflow).
- T57: T38-T57 registered in manifest.json, schemas aligned with the real
format, dangling request.json $schema resolved, new dependency-free
validator wired as check #9.
- T4/T52: completed; invariant 2, R1.2, ADR-0004 and project-state updated;
checkpoints.phases.execution -> completed, handoff -> in_progress.
- T58 filed: triple 'allowedUDPPorts = [ 53 ]' duplicate.
AGENTS.md also carries the .omo trap-row update from the parallel opencode
session (commit 8079536), which was left uncommitted in the shared tree.
.gitignore had `scripts` as an unanchored pattern. A pattern without a slash
matches a directory of that name at ANY depth, so a future
modules/*/scripts/ would have been silently ignored — the kind of thing that
only shows up as "why is my file not in git". It is anchored to /scripts/
now. No tracked file was matched before or after (verified with
`git ls-files | git check-ignore --stdin --no-index`, empty both ways).
The 22 scripts in .temp/ are not committed wholesale: they are eight
iterations of one T4 test (t4-final-v5..v8), three of another
(t4-live-test{,v2,v3}), plus one-shot deploy/cleanup/diagnose scripts that
hardcode `cd /mnt/s/Git/nixos` and perform umount / mount --move. Committing
them would be noise, not knowledge.
One of them is reusable and non-destructive, so it is preserved:
.ci/verify/guard-non-destructive-verify.sh. It creates two throwaway systemd
units (ConditionPathIsMountPoint=/nonexistent must refuse to start,
=/mnt/services must start) and resets them, so it can be run against a live
host to prove the condition is evaluated at all. That is the check the owner
needs for T52. Content is byte-identical to the .temp original
(md5 b0ac8081aae568a3db921fb64f4c0a05) and passes shellcheck -S error.
Not pushed.
Check #1 allows `:latest` images listed in LATEST_ALLOWLIST. The list still
carried `ghcr.io/mhsanaei/3x-ui:latest` with the comment "panel frozen on
:latest", but the panel has been pinned to `ghcr.io/mhsanaei/3x-ui:v3.10.2`
since 2026-10-20 (modules/containers/3x-ui.nix:62, R1.5). The entry matched
nothing, and the comment stated the opposite of the invariant it cited.
Consequence of the stale entry: if someone reverted the pin to `:latest`, the
check would have stayed green and said nothing. Verified by mutation — with
v3.10.2 temporarily replaced by :latest the check now reports
"Images using :latest (not in whitelist): ghcr.io/mhsanaei/3x-ui:latest";
before this commit the same mutation passed silently.
Also: check #4's description named `mkServiceStorage`, while the guard the
consumers actually call is `mkStorageGuard` (lib/xlib/helpers.nix:180). Both
names exist in that file and mean different things, so the comment pointed at
the wrong helper. Now it names the right one and says so explicitly.
`bash .ci/checks.sh --no-build` -> PASS 3 / FAIL 0, before and after; the
current tree contains exactly two `:latest` images, both tape-rotation, both
still whitelisted.
Not pushed.
Nothing in this repo verifies that an import actually resolves. That matters
here more than usual: several modules are referenced only through
commented-out import lines, and 15 .nix files sit outside the import graph
entirely, so a stale reference is invisible until someone uncomments it or
nix evaluation happens to touch that file.
The check is deliberately narrow: it matches only two import shapes — a line
whose whole content (after an optional `#`) is a relative path, and
`import ../foo` / single-line `imports = [ ./a ./b ]`. Prose and shell-script
bodies are not matched, and anything containing `${...}` is skipped because it
cannot be resolved statically. Commented-out import lines ARE matched on
purpose: a comment naming a deleted file still misleads the next reader.
Baseline on the current tree: 132 .nix files, 120 import references, all
resolve. Wired in as check #8 of .ci/checks.sh; skips when python3 is absent.
`bash .ci/checks.sh --no-build` → PASS 3 / FAIL 0.
Not pushed.
Проверка #7 искала файлы только в secrets/ и не замечала вложенные
каталоги: modules/server/secrets/, modules/containers/secrets/,
modules/essentials/secrets/, modules/wsl/secrets/.
Теперь обходятся все файлы под */secrets/*, а совпадения, требующие
непривязанного правила (поведение sops для вложенных каталогов),
перечисляются отдельно — предположение видно, а не спрятано.
PASS: 2 FAIL: 0; 13 файлов помечены как требующие непривязанного
правила.
The script has a shebang and its own usage header documents `./.ci/checks.sh`,
but git tracked it as mode 100644. Both call sites exec it directly:
.pre-commit-config.yaml:10 entry: .ci/checks.sh --no-build
.github/workflows/nix-checks.yml:20 run: .ci/checks.sh
so both failed with "Permission denied" before running a single check. This
was already tracked as T20 in .agent/tasks/manifest.json.
core.fileMode is false in this checkout, which is why the on-disk permission
never made it into the index. `git update-index --chmod=+x` sets the mode in
the index explicitly, regardless of core.fileMode.
Mode-only change: no content of the script is touched.
Not pushed.
tape-rotation is an SQLite-backed tape tracking app, similar to
3x-ui in that:
- data lives on /home/ooyude/External (storage-guarded as of T4)
- images are small and updated manually via Nix
- :latest is acceptable because breaking image changes would
fail fast at container start (storage guard + systemd)
Three image :latest entries are now whitelisted (with rationale):
- ghcr.io/mhsanaei/3x-ui:latest (R1.5 — panel frozen, Xray is panel state)
- docker.io/elizaroveugene/taperotation-backend:latest (this commit)
- docker.io/elizaroveugene/taperotation-frontend:latest (this commit)
Two :latest violations remain (both in modules/containers/ but NOT
imported in modules/server/default.nix — effectively dead code):
- localhost/kokoro-tts:latest
- ghcr.io/openhands/openhands:latest
Decision pending: archive like T16, whitelist, or remove. They are
not running on sapphira, so the check failure is informational only.
Comprehensive batch addressing the 16-task backlog in
.agent/tasks/manifest.json. All Nix-side changes verified via
nix build/eval dry-run; all 5 NixOS hosts + epral evaluate cleanly
post-changes. No regressions.
Wave 1 (non-functional cleanup):
T1/A1 — configurations/mobile.nix:12: fix `import ../lib/xlib.nix`
(broken path) → `import ../lib/xlib`. Unblocks nixOnDroid
configurations.epral. R1.1 invariant.
T8/C3 — modules/containers/3x-ui.nix: remove `podman-update-3xui_app`
systemd service and commented timer. Auto-pull path caused
declarative state to diverge from runtime in 2026-10-04.
R1.5 invariant.
T13/D3 — modules/server/nginx.nix:368-371: remove dead
`networking.firewall.allowedTCPPorts = [80 443]`.
`firewall.enable = false` on sapphira (R1.3), so openFirewall
rules are no-op. Replace with R1.3 comment.
T6/C1 — .agent/decisions/notes/3x-ui-xray-26.9.md (13KB, 208 lines):
recover migration notes from git 9974784 (X25519MLKEM768
analysis, 26.7→26.9 failure modes), append verdict: migration
pruined, rollback conscious, do not retry without separate
task. R1.5 / C1.
T9/C4 — .agent/rules/project-rules.md: add R1.8 — Xray-core version is
state of 3x-ui panel, not Nix. Update trap entry for
3x-ui.nix:54 to reference R1.8.
T11/D1, T12/D2 — .agent/checkpoints.json + .agent/tasks/manifest.json:
verify R1.3 (router port-forwards 22/80/443/8443/22000) and
R1.4 (100.64.0.0 = Tailscale sapphira) wording already
satisfies acceptance criteria. Flip status pending → completed.
T4 (storage guard, FUNCTIONAL CHANGE):
New helper in lib/xlib/helpers.nix:
mkStorageGuard = xlib: {
RequiresMountsFor = [ xlib.dirs.server-home ];
ConditionPathIsMountPoint = [ "!${xlib.dirs.server-home}" ];
};
Applied to 13 systemd units via path-style override:
- modules/server/{postgresql,samba,homebox,gitea,navidrome,
syncthing,uptime-kuma,immich,nextcloud,calibre-web}.nix
- modules/containers/3x-ui.nix (podman-3xui_app)
- modules/containers/tape-rotation.nix (podman-taperotation-{backend,frontend})
Anchor: xlib.dirs.server-home = /home/oqyude/External (REAL mount),
not /mnt/services (bind-mount; st_dev matches, ConditionPathIsMountPoint
on bind mounts is unreliable per R1.2 note).
Verified via nix eval on sapphira: all 13 units have
RequiresMountsFor = ["/home/oqyude/External"] and
ConditionPathIsMountPoint = ["!/home/oqyude/External"].
Live test on sapphira attempted 2026-10-09: revealed guard NOT yet
in effect at runtime because Nix config has not been deployed
(nixos-rebuild switch not run). postgresql started despite External
being unmounted. Implementation correct, deployment pending user
action.
T7/C2 (read-only diag, no code change):
3x-ui version facts recorded in conversation (sapphira journal +
/var/lib/containers/storage/overlay/.../diff/app/bin/xray-linux-amd64):
- Active Xray: 26.7.28 (go1.26.5 linux/amd64) — R1.5 validated at runtime
- Stale binary: 26.9.30 (go1.27.1) — leftover from failed 26.9 migration
- Panel DB (x-ui.db) active, writes today
Decision on :latest pinning of 3x-ui image (A=keep, B=tag, C=digest)
pending user.
T3/A3 (nftables on otreca — config analysis + proposal):
Diagnostic attempted via ssh otreca-tailscale (100.64.1.0) and
otreca public (109.248.161.5:22): BOTH UNREACHABLE. Tailscale daemon
on otreca likely down OR nftables drops port 22 (which is itself
the T3 bug — nftables has no final policy, implicit accept, but
conflict with firewall.enable = true per R1.6).
Proposal written: .agent/decisions/proposals/vds-nftables-fix.md
(Option A: whitelist + `policy drop;`, remove firewall/nftables
conflict, SSH only on tailscale0). Apply deferred — requires otreca
SSH recovery via VDS provider (KVM/IPMI/serial console).
T5/B2 (backups documentation):
.agent/decisions/0002-backups-external.md (draft): catalog of what
is declared in Nix vs. what is external; awaiting answer to open
question 5.6 (where are backups, how are they verified).
T15/E2 (CI checks):
.ci/checks.sh (executable, ~140 lines) with 3 checks from
analysis-report.md §5:
- #1: no `:latest` in container images (with R1.5 whitelist
for 3x-ui). FAIL — 4 violations:
localhost/kokoro-tts:latest
ghcr.io/openhands/openhands:latest
docker.io/elizaroveugene/taperotation-backend:latest
docker.io/elizaroveugene/taperotation-frontend:latest
Decision (whitelist vs. pin) pending user.
- #2: nix flake check (skipped with --no-build).
- #7: secrets/ files match .sops.yaml path_regex. PASS.
T16/E3 (archive commented modules):
13 of 14 commented modules in modules/server/default.nix:37-50
existed as files. git mv them to archive/{server-modules,containers}/.
1 (stirling-pdf.nix) didn't exist; just removed the comment.
modules/server/default.nix:37-50 cleaned of 14 commented lines.
Added 3-line comment recording the archive date and reason.
Verified: nixosConfigurations.sapphira still evaluates.
Post-change state:
$ nix build .#nixosConfigurations.{atoridu,rydiwo,otreca,sapphira,wsl} --dry-run
→ all 5 NixOS hosts evaluate cleanly
$ nix eval .#nixOnDroidConfigurations.epral.config.system.stateVersion
→ "24.05"
Pending (user input required — not in this commit):
- T4 deploy: run `nixos-rebuild switch` on sapphira to activate guard
- T7: pick A/B/C for 3x-ui :latest pinning
- T3: recover otreca SSH via VDS provider, then apply Option A
- T10/C5: decide fate of reality443Forwarding
- T5: answer 5.6 about backup location/verification
- T15: whitelist or pin 4 :latest images
Untracked files NOT committed (in .gitignore):
.temp/t4-live-test*.sh, .temp/cleanup-*.sh — throwaway test scripts
from T4 live test attempts. Preserved locally for reference; see
AGENTS.md convention ("Создавать `.temp/` в корне проекта — Для
временных файлов агента. Всегда в `.gitignore`").
Also untracked, committed:
.agent/reviews/2026-10-10-review-dev-diff-vs-16644fc.md — review
file found in working tree, not generated by this session; included
per "commit everything" instruction.