Personal Nix setup
at main 5.1 kB view raw
1{ lib, config, helpers, pkgs, ... } @ inputs: 2 3with lib; 4let 5 inherit (import ../../lib/colors.nix inputs) hex; 6 7 cfg = config.modules.apps; 8in { 9 options.modules.apps.ghostty = { 10 enable = mkOption { 11 default = false; 12 description = "Whether to enable Ghostty."; 13 type = types.bool; 14 }; 15 16 font_size = mkOption { 17 default = if helpers.isDarwin then 14 else 11.5; 18 type = types.either types.int types.float; 19 }; 20 21 cell_adjust = mkOption { 22 default = if helpers.isDarwin then 0 else "-2%"; 23 type = types.either types.int types.str; 24 }; 25 26 window_padding_x = mkOption { 27 default = if helpers.isDarwin then 2 else 1; 28 type = types.int; 29 }; 30 31 window_padding_y = mkOption { 32 default = 0; 33 type = types.int; 34 }; 35 }; 36 37 config = mkIf (cfg.enable && cfg.ghostty.enable) (mkMerge [ 38 (helpers.mkIfLinux { 39 home.packages = [pkgs.ghostty]; 40 }) 41 42 { 43 xdg.configFile."ghostty/config".text = '' 44 font-family = Dank Mono 45 font-family = codicon 46 font-size = ${toString cfg.ghostty.font_size} 47 bold-is-bright = false 48 49 background = ${hex.black} 50 foreground = ${hex.white} 51 52 palette = 0=${hex.black} 53 palette = 1=${hex.red} 54 palette = 2=${hex.green} 55 palette = 3=${hex.yellow} 56 palette = 4=${hex.blue} 57 palette = 5=${hex.magenta} 58 palette = 6=${hex.aqua} 59 palette = 7=${hex.white} 60 palette = 8=${hex.grey} 61 palette = 9=${hex.brightRed} 62 palette = 10=${hex.brightGreen} 63 palette = 11=${hex.orange} 64 palette = 12=${hex.brightBlue} 65 palette = 13=${hex.pink} 66 palette = 14=${hex.cyan} 67 palette = 15=${hex.muted} 68 69 split-divider-color = ${hex.split} 70 cursor-color = ${hex.white} 71 cursor-style = block 72 cursor-style-blink = false 73 cursor-text = ${hex.grey} 74 cursor-opacity = 0.8 75 adjust-cursor-thickness = 1 76 77 adjust-cell-width = ${toString cfg.ghostty.cell_adjust} 78 window-padding-x = ${toString cfg.ghostty.window_padding_x} 79 window-padding-y = ${toString cfg.ghostty.window_padding_y} 80 window-padding-balance = true 81 window-padding-color = extend 82 window-theme = ghostty 83 window-colorspace = display-p3 84 window-save-state = always 85 window-decoration = server 86 window-vsync = true 87 window-inherit-working-directory = true 88 unfocused-split-opacity = 0.9 89 freetype-load-flags = no-monochrome 90 91 adjust-underline-thickness = -1 92 adjust-underline-position = 1 93 94 copy-on-select = false 95 confirm-close-surface = false 96 quit-after-last-window-closed = true 97 98 linux-cgroup = single-instance 99 100 macos-option-as-alt = left 101 macos-titlebar-style = tabs 102 103 adw-toolbar-style = flat 104 gtk-titlebar = false 105 106 shell-integration-features = no-cursor,sudo,title 107 shell-integration = zsh 108 109 mouse-hide-while-typing = true 110 mouse-shift-capture = true 111 mouse-scroll-multiplier = 0.7 112 113 clipboard-read = allow 114 clipboard-paste-protection = false 115 116 quick-terminal-position = bottom 117 118 keybind = clear 119 keybind = super+q=quit 120 keybind = super+w=close_surface 121 keybind = super+a=select_all 122 keybind = super+h=toggle_visibility 123 124 keybind = super+zero=reset_font_size 125 keybind = super+equal=increase_font_size:2 126 keybind = super+plus=increase_font_size:2 127 keybind = super+minus=decrease_font_size:2 128 keybind = ctrl+zero=reset_font_size 129 keybind = ctrl+equal=increase_font_size:2 130 keybind = ctrl+plus=increase_font_size:2 131 keybind = ctrl+minus=decrease_font_size:2 132 133 keybind = ctrl+a>z=toggle_split_zoom 134 keybind = ctrl+a>x=close_surface 135 keybind = ctrl+a>i=inspector:toggle 136 keybind = ctrl+a>f=toggle_fullscreen 137 keybind = ctrl+a>q=toggle_quick_terminal 138 keybind = ctrl+a>space=jump_to_prompt:1 139 140 keybind = ctrl+a>shift+five=new_split:right 141 keybind = ctrl+a>shift+apostrophe=new_split:down 142 keybind = ctrl+a>d=new_split:right 143 keybind = ctrl+a>s=new_split:down 144 145 keybind = ctrl+a>n=next_tab 146 keybind = ctrl+a>p=previous_tab 147 keybind = ctrl+a>c=new_tab 148 keybind = ctrl+a>o=toggle_tab_overview 149 keybind = ctrl+a>shift+n=move_tab:1 150 keybind = ctrl+a>shift+p=move_tab:-1 151 152 keybind = ctrl+h=goto_split:left 153 keybind = ctrl+j=goto_split:bottom 154 keybind = ctrl+k=goto_split:top 155 keybind = ctrl+l=goto_split:right 156 157 keybind = ctrl+a>h=resize_split:left,40 158 keybind = ctrl+a>j=resize_split:down,40 159 keybind = ctrl+a>k=resize_split:up,40 160 keybind = ctrl+a>l=resize_split:right,40 161 keybind = ctrl+a>g=equalize_splits 162 163 keybind = performable:super+c=copy_to_clipboard 164 keybind = performable:super+v=paste_from_clipboard 165 166 keybind = global:cmd+grave_accent=toggle_quick_terminal 167 ''; 168 } 169 ]); 170}