Nix module and source build for the Ghostty GPU-accelerated
terminal emulator. Provides a home-manager module with an opinionated Nord theme,
GLSL shader effects, and curated keybindings. On macOS, supports building Ghostty
from source using Zig + Swift via mkZigSwiftApp (requires Xcode). On Linux,
re-exports the upstream Ghostty package.
ghostty (upstream src) substrate (Zig/Swift overlays)
| |
v v
pkgs/ghostty-darwin.nix blackmatter-macos (mkZigSwiftApp)
| |
+-----+--------------------+
|
v
packages.ghostty ---------> overlays.default
|
v
module/default.nix --------> homeManagerModules.default
| | |
v v v
themes/ shaders/ keybindings
(Nord) (bloom, (prompt nav,
cursor splits,
trail) quick term)
Darwin build flow: Ghostty source is compiled via a 3-stage process:
- Zig build — compiles the core terminal engine (libghostty), resources (terminfo, shell-integration), and Metal shaders
- Xcodebuild — builds the Swift/SwiftUI macOS app shell using the Zig-built xcframework
- Bundle install — assembles the final
Ghostty.appwith embedded frameworks (Sparkle for auto-updates), resources, and CLI symlinks
The Darwin build is impure (__noChroot = true) because it requires system Xcode
for SwiftUI compilation and Metal shader toolchain.
- Nord color theme — enhanced 16-color palette based on the Nord palette, with custom foreground/selection tuning for elegance
- GLSL shaders — optional bloom glow and cursor trail effects
- Curated keybindings — prompt navigation (cmd+up/down), split management (ctrl+shift+arrows), quick terminal toggle (cmd+grave)
- Shell integration — cursor, sudo, title, ssh-env, ssh-terminfo features enabled by default
- Dual platform — Linux uses home-manager's
programs.ghostty; macOS writes config directly to~/.config/ghostty/config - Source build option — build Ghostty from source on macOS instead of using prebuilt binary
- Full customization — every setting exposed as a typed NixOS option with sensible defaults
{
inputs.blackmatter-ghostty = {
url = "github:pleme-io/blackmatter-ghostty";
inputs.nixpkgs.follows = "nixpkgs";
inputs.substrate.follows = "substrate";
inputs.blackmatter-zig.follows = "blackmatter-zig";
};
}{
imports = [ inputs.blackmatter-ghostty.homeManagerModules.default ];
blackmatter.components.ghostty = {
enable = true;
# All other options have sensible defaults
};
}{
nixpkgs.overlays = [ inputs.blackmatter-ghostty.overlays.default ];
# Provides: pkgs.ghostty (source build on Darwin, upstream on Linux)
}All options live under blackmatter.components.ghostty. Defaults shown below.
| Option | Type | Default | Description |
|---|---|---|---|
font.family |
string | "JetBrains Mono" |
Font family |
font.size |
int | 12 |
Font size |
font.thicken |
bool | true |
Font thickening for readability |
font.adjustCellHeight |
int | 0 |
Cell height adjustment (%) |
| Option | Type | Default | Description |
|---|---|---|---|
window.paddingX |
int | 12 |
Horizontal padding (px) |
window.paddingY |
int | 12 |
Vertical padding (px) |
window.decoration |
bool | true |
Window decorations |
window.gtkTitlebar |
bool | true |
GTK titlebar (Linux) |
| Option | Type | Default | Description |
|---|---|---|---|
appearance.backgroundOpacity |
float | 0.95 |
Background opacity |
appearance.backgroundBlurRadius |
int | 32 |
Background blur (px) |
appearance.unfocusedSplitOpacity |
float | 0.8 |
Unfocused split opacity |
appearance.boldIsBright |
bool | false |
Bold text uses bright colors |
appearance.windowColorspace |
string | "srgb" |
Colorspace (srgb or display-p3) |
appearance.macosTitlebarStyle |
enum | "transparent" |
native, transparent, or tabs |
appearance.fontThickenStrength |
int | 70 |
Font thicken strength (0-255, macOS) |
| Option | Type | Default | Description |
|---|---|---|---|
theme.nordTheme |
bool | true |
Use enhanced Nord color theme |
theme.useBuiltinNord |
bool | false |
Use Ghostty's built-in Nord instead of custom |
theme.customColors |
attrs | {} |
Color overrides (background, foreground, etc.) |
| Option | Type | Default | Description |
|---|---|---|---|
cursor.style |
enum | "block" |
block, bar, or underline |
cursor.blink |
bool | true |
Cursor blinking |
| Option | Type | Default | Description |
|---|---|---|---|
shaders.enable |
bool | false |
Enable GLSL shader effects |
shaders.bloom |
bool | true |
Subtle bloom glow on bright text |
shaders.cursorTrail |
bool | true |
Cursor trail effect |
shaders.animation |
bool | true |
Shader animation |
shaders.custom |
list of paths | [] |
Additional custom shader files |
| Option | Type | Default | Description |
|---|---|---|---|
keybindings.enable |
bool | true |
Enable curated keybindings |
keybindings.promptNavigation |
bool | true |
cmd+up/down to jump prompts |
keybindings.splitManagement |
bool | true |
ctrl+shift+arrows for splits |
keybindings.quickTerminal |
bool | true |
cmd+grave for quick terminal |
keybindings.custom |
list of strings | [] |
Additional keybindings |
| Option | Type | Default | Description |
|---|---|---|---|
darwin.useSourceBuild |
bool | false |
Build from source (requires Xcode) |
| Option | Type | Default | Description |
|---|---|---|---|
extraSettings |
attrs | {} |
Additional Ghostty settings (key-value) |
blackmatter.components.ghostty.enable = true;blackmatter.components.ghostty = {
enable = true;
font.family = "FiraCode Nerd Font";
font.size = 14;
appearance.backgroundOpacity = 0.90;
appearance.macosTitlebarStyle = "tabs";
cursor.style = "bar";
shaders.enable = true;
keybindings.custom = [ "ctrl+shift+c=copy_to_clipboard" ];
darwin.useSourceBuild = true; # Build from source on macOS
extraSettings = { "macos-option-as-alt" = true; };
};Requires Xcode installed at /Applications/Xcode.app.
# Build the macOS app (~40 min on M4)
nix build .#ghostty --impure
# Result is a symlink to the Nix store containing Ghostty.app
ls -la result/Applications/Ghostty.appnix develop # Provides Zig + Swift toolchainsnix flake check # Module evaluation, theme colors, shaders, keybindingsChecks verify:
- Module options exist and are well-formed
- Nord palette structure is complete (16 colors)
- Module enables correctly on both Darwin and Linux
- Shader-enabled configuration evaluates
- Keybinding configuration evaluates
darwin.useSourceBuildoption works (Darwin only)
The macOS source build has been tested on:
| Node | Hardware | Arch | macOS | Xcode | System Swift | Nix Swift Toolchain |
|---|---|---|---|---|---|---|
| cid | MacBook Pro M1 Max | aarch64-darwin | 15.x | 16.x | 6.x | 6.2.4 |
| ryn | MacBook Pro M4 Pro (48GB) | aarch64-darwin | 15.3.1 | 16.4 (16F6) | 6.1.2 | 6.2.4 |
Minimum requirements: Xcode 16.0+, macOS on aarch64-darwin or x86_64-darwin. The build detects the platform, Xcode version, macOS version, and Swift version at the start of the build phase and errors out early with a clear message if requirements are not met.
The build uses the nix-provided Swift 6.2.4 toolchain via SWIFT_EXEC, making it
independent of the system Xcode Swift version. Any Xcode that provides the macOS SDK
and Metal toolchain should work.
The macOS source build applies four patches to upstream Ghostty:
- GhosttyXCFramework.zig — skips iOS/iOS Simulator targets for native-only builds
- MetallibStep.zig — invokes
metal/metallibdirectly from PATH instead of viaxcrun(required becausexcruncannot execute cryptex-mounted binaries inside the Nix sandbox) - GhosttyXcodebuild.zig — passes through environment variables (HOME, DEVELOPER_DIR, TMPDIR, PATH, SWIFT_EXEC) to xcodebuild and adds vendored Sparkle framework search paths. SWIFT_EXEC ensures the nix-provided Swift compiler is used instead of the Xcode-bundled one.
- pbxproj strip-spm — removes Sparkle SPM dependency from the Xcode project (SwiftPM calls
/usr/bin/sandbox-execwhich the Nix daemon user cannot use)
Sparkle is vendored as an xcframework and embedded during the install phase.
blackmatter-ghostty/
flake.nix # Flake — packages, overlay, HM module, checks
module/
default.nix # Home-manager module (all config options)
themes/
nord/colors.nix # Nord palette definition (16 colors)
shaders/
bloom.glsl # Bloom glow shader
cursor-trail.glsl # Cursor trail shader
pkgs/
ghostty-darwin.nix # macOS source build derivation
patches/
GhosttyXCFramework.zig # Skip iOS targets
GhosttyXcodebuild.zig # Env passthrough + Sparkle framework paths
MetallibStep.zig # Direct Metal toolchain invocation
- Ghostty — upstream terminal emulator
- blackmatter-macos —
mkZigSwiftAppbuilder used for the macOS source build - blackmatter-zig — Zig toolchain overlay
- substrate — Nix build patterns and toolchain overlays
- dev-tools —
nix-macosCLI used for build environment discovery and app bundle installation
MIT