{ inputs, ... }: { flake-file.inputs = { nixgl = { url = "github:nix-community/nixGL"; inputs.nixpkgs.follows = "nixpkgs"; }; }; flake.homeModules.ghostty = { config, pkgs, lib, ... }: { home.sessionVariables = { TERMINAL = "ghostty"; }; targets.genericLinux.nixGL = { packages = inputs.nixgl.packages.${pkgs.system}; defaultWrapper = "mesa"; installScripts = [ "mesa" ]; }; programs.ghostty = { enable = true; enableZshIntegration = true; package = config.lib.nixGL.wrap pkgs.ghostty; settings = { command = "TERM=xterm-256color ${lib.getExe pkgs.zsh}"; font-size = 12; font-family = "Source Code Pro"; theme = "Catppuccin Mocha"; copy-on-select = true; shell-integration = "zsh"; shell-integration-features = [ "no-title" "sudo" ]; gtk-single-instance = true; window-position-x = 25; window-position-y = 25; # window-height = 40; # window-width = 200; # window-padding-balance = true; # window-padding-x = 5; # window-padding-y = 5; initial-window = true; resize-overlay = "never"; keybind = [ "ctrl+s>n=new_split:down" "ctrl+t>n=new_tab" "ctrl+t>1=goto_tab:1" "ctrl+t>2=goto_tab:2" "ctrl+t>3=goto_tab:3" "ctrl+s>i=goto_split:up" "ctrl+s>k=goto_split:down" ]; }; }; # https://github.com/ghostty-org/ghostty/discussions/3763#discussioncomment-11699970 xdg.desktopEntries."com.mitchellh.ghostty" = { name = "Ghostty"; type = "Application"; comment = "A terminal emulator"; exec = "nixGLMesa ghostty"; icon = "com.mitchellh.ghostty"; terminal = false; startupNotify = true; categories = [ "System" "TerminalEmulator" ]; settings = { Keywords = "terminal;tty;pty;"; X-GNOME-UsesNotifications = "true"; X-TerminalArgExec = "-e"; X-TerminalArgTitle = "--title="; X-TerminalArgAppId = "--class="; X-TerminalArgDir = "--working-directory="; X-TerminalArgHold = "--wait-after-command"; }; actions = { new-window = { name = "New Window"; exec = "nixGLMesa ghostty"; }; }; }; }; }