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

83 lines
2.2 KiB
Nix
Raw Normal View History

2025-06-12 20:09:05 +02:00
{
config,
lib,
pkgs,
...
}:
let
2025-06-12 20:09:05 +02:00
inherit (lib.lists) elem;
inherit (lib.meta) getExe;
2025-07-03 23:34:56 +02:00
inherit (lib.attrsets) mapAttrsToList;
inherit (lib.strings) concatStringsSep;
2025-06-12 20:09:05 +02:00
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";
2025-06-12 20:09:05 +02:00
2025-07-03 23:34:56 +02:00
ghostty-settings = {
font-size = 14;
2025-07-13 22:51:22 +02:00
font-family = "JetBrainsMonoNerdFont";
# font-style-bold = JetBrainsMono NF Regular;
# font-style-bold-italic = JetBrainsMono NF Italic;
2025-06-12 20:09:05 +02:00
2025-07-13 22:51:22 +02:00
app-notifications = "no-clipboard-copy";
2025-07-18 23:15:01 +02:00
background-opacity = 0.9;
2025-07-13 22:51:22 +02:00
bold-is-bright = "true";
confirm-close-surface = "false";
cursor-style-blink = "false";
2025-07-03 23:34:56 +02:00
gtk-single-instance = "true";
gtk-tabs-location = "bottom";
gtk-wide-tabs = false;
mouse-hide-while-typing = "true";
2025-07-13 22:51:22 +02:00
resize-overlay-duration = "0s";
2025-07-03 23:34:56 +02:00
shell-integration-features = "cursor,sudo,no-title";
2025-07-13 22:51:22 +02:00
term = "xterm-256color";
theme = slug;
window-decoration = "none";
window-padding-balance = true;
window-padding-x = 8;
window-padding-y = 8;
window-theme = "ghostty";
2025-07-03 23:34:56 +02:00
cursor-style = "block";
# Whether to automatically copy selected text to the clipboard. true will prefer to copy to the selection clipboard, otherwise it will copy to the system clipboard.
# The value clipboard will always copy text to the selection clipboard as well as the system clipboard.
copy-on-select = "clipboard";
2025-07-08 13:57:04 +02:00
inherit shell-integration;
2025-07-13 22:51:22 +02:00
2025-07-03 23:34:56 +02:00
command = getExe package;
};
settingsFile =
pkgs.writeText "config"
<| concatStringsSep "\n"
<| mapAttrsToList (name: value: "${name} = ${toString value}") ghostty-settings;
2025-07-03 23:34:56 +02:00
2025-06-12 20:09:05 +02:00
ghostty-wrapped = pkgs.symlinkJoin {
name = "ghostty-wrapped";
paths = [ pkgs.ghostty ];
nativeBuildInputs = [ pkgs.makeWrapper ];
2025-06-12 20:09:05 +02:00
postBuild = ''
2025-07-03 23:34:56 +02:00
wrapProgram $out/bin/ghostty --add-flags "--config-file=${settingsFile}"
2025-06-12 20:09:05 +02:00
'';
};
in
{
2025-06-12 20:09:05 +02:00
environment.systemPackages = builtins.attrValues {
inherit ghostty-wrapped;
};
}