Files
playpen/flake.nix
T
Greyson Parrelli 738cead680 vtabs: terminal with vertical tabs on libghostty-vt + GTK4
Uses libghostty-vt (the API Ghostty documents for external embedders) for
the terminal core. Ghostty's other C API, ghostty.h, exposes a full terminal
surface but only supports macOS and iOS platform tags, so it cannot be
embedded on Linux.

We supply the layers libghostty-vt deliberately leaves out: PTY and process
management, a Cairo/Pango cell renderer, and a GTK4/libadwaita UI with a
Zen-style vertical tab sidebar.

Nix pins the whole toolchain (Zig 0.16 via zig-overlay, GTK 4.22, libadwaita)
so no host setup is needed.
2026-08-11 08:36:10 -04:00

98 lines
2.7 KiB
Nix

{
description = "Vertical-tab terminal built on libghostty-vt";
inputs = {
# Ghostty tracks nixpkgs-unstable to get GTK 4.20 / GNOME 49. We follow
# suit so that our zig-gobject bindings (shared with Ghostty) match the
# GObject introspection data of the GTK we link against.
nixpkgs.url = "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
systems = {
url = "github:nix-systems/default";
flake = false;
};
# Zig 0.16.0 is not in nixpkgs yet; libghostty-vt requires it.
zig = {
url = "github:mitchellh/zig-overlay";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-compat.follows = "flake-compat";
systems.follows = "systems";
};
};
};
outputs = {
self,
nixpkgs,
zig,
systems,
...
}: let
inherit (nixpkgs) lib legacyPackages;
forAllSystems = f:
lib.genAttrs (import systems) (system: f legacyPackages.${system} system);
in {
devShells = forAllSystems (pkgs: system: {
default = pkgs.mkShell {
name = "vtabs";
nativeBuildInputs = [
zig.packages.${system}."0.16.0"
pkgs.pkg-config
pkgs.gdb
# Used by ./shot.sh to run the app inside a throwaway headless
# compositor and screenshot it, so UI can be checked without
# touching the developer's real session.
pkgs.sway
pkgs.grim
pkgs.wtype
];
buildInputs = with pkgs; [
# GTK4 + libadwaita, the same native UI stack Ghostty uses on Linux.
gtk4
libadwaita
glib
gobject-introspection
pango
cairo
harfbuzz
gdk-pixbuf
graphene
# Windowing backends GTK links against.
wayland
libxkbcommon
libx11
# Font stack used by Pango for glyph rasterization.
fontconfig
freetype
# Icon themes so the app doesn't render missing-image icons.
adwaita-icon-theme
hicolor-icon-theme
];
shellHook = ''
# GTK needs to find icon themes and schemas at runtime when the app
# is launched straight out of the dev shell rather than installed.
export XDG_DATA_DIRS="${pkgs.gtk4}/share/gsettings-schemas/${pkgs.gtk4.name}:${pkgs.adwaita-icon-theme}/share:${pkgs.hicolor-icon-theme}/share:$XDG_DATA_DIRS"
export GSETTINGS_SCHEMA_DIR="${pkgs.gtk4}/share/gsettings-schemas/${pkgs.gtk4.name}/glib-2.0/schemas"
'';
};
});
formatter = forAllSystems (pkgs: _: pkgs.alejandra);
};
}