From 64adfc6ea47d4667901fdb7e3dcbe420c7a61626 Mon Sep 17 00:00:00 2001 From: Bloxx12 Date: Thu, 12 Jun 2025 20:09:05 +0200 Subject: [PATCH] modules: ghostty: init --- modules/programs/gui/ghostty/module.nix | 47 +++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 modules/programs/gui/ghostty/module.nix diff --git a/modules/programs/gui/ghostty/module.nix b/modules/programs/gui/ghostty/module.nix new file mode 100644 index 0000000..45fddb5 --- /dev/null +++ b/modules/programs/gui/ghostty/module.nix @@ -0,0 +1,47 @@ +{ + config, + lib, + pkgs, + ... +}: let + inherit (lib.lists) elem; + inherit (lib.meta) getExe; + + inherit (config.meta.mainUser.defaultShell) name package; + inherit (config.modules.style.colorScheme) slug; + + # Shell integration for ghostty only supports + # bash, fish and zsh for now. + shell-integration = + if elem name ["bash" "fish" "zsh"] + then name + else "none"; + + ghostty-settings = pkgs.writeText "config" '' + font-family = JetBrainsMono Nerd Font Mono + window-padding-x = 8 + window-padding-y = 8 + background-opacity = 0.85 + gtk-single-instance = true + font-size = 14 + theme = ${slug} + resize-overlay-duration = 0s + cursor-style-blink = false + + shell-integration = ${shell-integration} + command = ${getExe package} + ''; + + ghostty-wrapped = pkgs.symlinkJoin { + name = "ghostty-wrapped"; + paths = [pkgs.ghostty]; + nativeBuildInputs = [pkgs.makeWrapper]; + postBuild = '' + wrapProgram $out/bin/ghostty --add-flags "--config-file=${ghostty-settings}" + ''; + }; +in { + environment.systemPackages = builtins.attrValues { + inherit ghostty-wrapped; + }; +}