nichts/modules/programs/gui/ghostty/module.nix

49 lines
1.1 KiB
Nix
Raw Normal View History

2025-06-12 20:09:05 +02:00
{
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
confirm-close-surface = false
2025-06-12 20:09:05 +02:00
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;
};
}