terminal.nix
1 { 2 config, 3 flavor, 4 lib, 5 pkgs, 6 ... 7 }: 8 let 9 inherit (lib) mkOption types; 10 cfg = config.dusk.terminal; 11 12 configFile = '' 13 theme = ${cfg.theme} 14 window-theme = ${if (flavor == "nixos") then "ghostty" else "system"} 15 16 background-opacity = 0.8 17 background-blur = true 18 19 font-family = ${cfg.font-family} 20 font-size = ${toString cfg.font-size} 21 ''; 22 in 23 { 24 options.dusk.terminal = { 25 default = mkOption { 26 description = "The binary to the default terminal application"; 27 type = types.str; 28 default = "${pkgs.ghostty}/bin/ghostty"; 29 }; 30 31 font-family = mkOption { 32 type = types.str; 33 default = "Inconsolata NerdFont"; 34 }; 35 36 font-size = mkOption { 37 type = types.int; 38 default = 14; 39 }; 40 41 theme = mkOption { 42 description = "What theme to use on ghostty"; 43 type = types.str; 44 default = "catppuccin-mocha"; 45 }; 46 }; 47 48 config = 49 if (flavor == "nixos") then 50 { 51 environment.systemPackages = [ pkgs.ghostty ]; 52 53 home-manager.users.${config.dusk.username} = { 54 programs.bash.initExtra = '' 55 . ${pkgs.ghostty}/share/ghostty/shell-integration/bash/ghostty.bash 56 ''; 57 58 xdg.configFile."ghostty/config".text = configFile; 59 }; 60 } 61 else 62 { 63 homebrew = { 64 enable = true; 65 casks = [ "ghostty" ]; 66 }; 67 68 home-manager.users.${config.dusk.username} = { 69 programs.bash.initExtra = '' 70 if [ -n "''${GHOSTTY_RESOURCES_DIR}" ]; then 71 builtin source "''${GHOSTTY_RESOURCES_DIR}/shell-integration/bash/ghostty.bash" 72 fi 73 ''; 74 75 xdg.configFile."ghostty/config".text = configFile; 76 }; 77 }; 78 }