Commit 5492423
vt: own ghostty libghostty-vt via ix-vt (#332)
Draft. Owns the real terminal-emulation engine: ghostty's libghostty-vt,
wrapped in our own public `ix-vt` crate. New files only; does not touch
the vt100 path (the companion dashboard PR owns that). The vt100 to
ix-vt swap is a later third PR.
## What this does
- **`packages/vt/libghostty-vt`** (+ `lib/libghostty-vt.nix`): Nix
derivation building ghostty's `libghostty-vt` static lib +
self-contained dylib via `zig build -Demit-lib-vt=true` against a pinned
ghostty source, with zig deps vendored for a network-free build. zig
0.15.x only.
- **`packages/vt/ix-vt-sys`**: raw FFI, bindgen-generated `bindings.rs`
(495 symbols) over the ghostty C headers; `build.rs` links the Nix-built
lib.
- **`packages/vt/ix-vt`**: safe wrapper. `Terminal::new` / `vt_write` /
`resize` / a render-state snapshot exposing styled cells (fg/bg palette
+ RGB, bold/italic/underline/inverse), scrollback, and the cursor
(position, visible, blinking, visual style bar/block/underline/hollow).
Round-trip test in `tests/round_trip.rs`.
## Why own it instead of the community crate
The community `libghostty-vt` crate's build.rs runs native `zig build`
and fetches deps over the network, which fails the Nix purity and darwin
link gates. The capability is identical, so we own the build, not the
API. Proven by a spike: the lib built in ~57s and round-tripped a
DECSCUSR bar cursor, cursor position, and `#cc6666` styled cells through
the C API.
## Status
- Committed and pushed. Left: confirm `nix build .#libghostty-vt` + `nix
build .#ix-vt` + the round-trip test green under Nix, then `nix run
.#lint`, then ready for review.
## Notes for the reviewer
- zig 0.15.x exactly (requireZig is a comptime gate; 0.16 is rejected).
- The static `.a` does not bundle its C++ deps (needs sibling
`libhighway`/`libsimdutf`/`libutfcpp` + `-lc++`); the dylib is
self-contained, so `build.rs` prefers it.
- zig deps vendored via zon2nix.
- Minor: this branch also touched
`packages/mcp/src/server_instructions.txt` (+2 lines), which the
companion PR also edits. Resolve at merge (let the dashboard PR win).
Made with Claude (claude-opus-4-8).
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent dcbac81 commit 5492423
23 files changed
Lines changed: 2615 additions & 10 deletions
File tree
- lib
- packages
- nix-cargo-unit
- vt
- ix-vt-sys
- src
- ix-vt
- src
- tests
- libghostty-vt
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
53 | 65 | | |
54 | 66 | | |
55 | 67 | | |
| |||
60 | 72 | | |
61 | 73 | | |
62 | 74 | | |
| 75 | + | |
63 | 76 | | |
64 | 77 | | |
65 | 78 | | |
| |||
104 | 117 | | |
105 | 118 | | |
106 | 119 | | |
| 120 | + | |
107 | 121 | | |
108 | 122 | | |
109 | 123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
459 | 459 | | |
460 | 460 | | |
461 | 461 | | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
462 | 527 | | |
463 | | - | |
464 | | - | |
| 528 | + | |
465 | 529 | | |
466 | 530 | | |
467 | 531 | | |
468 | 532 | | |
469 | 533 | | |
470 | 534 | | |
471 | 535 | | |
472 | | - | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
473 | 540 | | |
474 | 541 | | |
475 | 542 | | |
| |||
494 | 561 | | |
495 | 562 | | |
496 | 563 | | |
497 | | - | |
| 564 | + | |
498 | 565 | | |
499 | 566 | | |
500 | 567 | | |
501 | 568 | | |
502 | 569 | | |
503 | | - | |
| 570 | + | |
504 | 571 | | |
505 | | - | |
| 572 | + | |
506 | 573 | | |
507 | | - | |
| 574 | + | |
508 | 575 | | |
509 | 576 | | |
510 | | - | |
| 577 | + | |
511 | 578 | | |
512 | 579 | | |
513 | 580 | | |
| |||
581 | 648 | | |
582 | 649 | | |
583 | 650 | | |
| 651 | + | |
584 | 652 | | |
585 | 653 | | |
586 | 654 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
79 | 80 | | |
80 | 81 | | |
81 | 82 | | |
| 83 | + | |
82 | 84 | | |
83 | 85 | | |
84 | 86 | | |
| |||
237 | 239 | | |
238 | 240 | | |
239 | 241 | | |
| 242 | + | |
240 | 243 | | |
241 | 244 | | |
242 | 245 | | |
| |||
257 | 260 | | |
258 | 261 | | |
259 | 262 | | |
| 263 | + | |
| 264 | + | |
260 | 265 | | |
261 | 266 | | |
262 | 267 | | |
| |||
277 | 282 | | |
278 | 283 | | |
279 | 284 | | |
| 285 | + | |
280 | 286 | | |
281 | 287 | | |
282 | 288 | | |
| |||
361 | 367 | | |
362 | 368 | | |
363 | 369 | | |
| 370 | + | |
364 | 371 | | |
365 | 372 | | |
366 | 373 | | |
| |||
0 commit comments