fork/home-manager
git clone https://git.julia.blue/fork/home-manager
f92a54fe
master
1{ config , lib , pkgs , ...} : 2 3with lib ; 4 5let 6 7cfg = config . programs . wezterm ; 8tomlFormat = pkgs . formats . toml { }; 9 10shellIntegrationStr = '' 11source " ${ cfg . package } /etc/profile.d/wezterm.sh" 12'' ; 13 14in { 15meta . maintainers = [ hm . maintainers . blmhemu ]; 16 17options . programs . wezterm = { 18enable = mkEnableOption "wezterm" ; 19 20package = mkOption { 21type = types . package ; 22default = pkgs . wezterm ; 23defaultText = literalExpression "pkgs.wezterm" ; 24description = "The Wezterm package to install." ; 25}; 26 27extraConfig = mkOption { 28type = types . lines ; 29default = '' 30return {} 31'' ; 32example = literalExpression '' 33-- Your lua code / config here 34local mylib = require 'mylib'; 35return { 36usemylib = mylib.do_fun(); 37font = wezterm.font("JetBrains Mono"), 38font_size = 16.0, 39color_scheme = "Tomorrow Night", 40hide_tab_bar_if_only_one_tab = true, 41default_prog = { "zsh", "--login", "-c", "tmux attach -t dev || tmux new -s dev" }, 42keys = { 43{key="n", mods="SHIFT|CTRL", action="ToggleFullScreen"}, 44} 45} 46'' ; 47description = '' 48Extra configuration written to 49{file}`$XDG_CONFIG_HOME/wezterm/wezterm.lua`. See 50<https://wezfurlong.org/wezterm/config/files.html> 51how to configure. 52'' ; 53}; 54 55colorSchemes = mkOption { 56type = types . attrsOf ( tomlFormat . type ); 57default = { }; 58example = literalExpression '' 59myCoolTheme = { 60ansi = [ 61"#222222" "#D14949" "#48874F" "#AFA75A" 62"#599797" "#8F6089" "#5C9FA8" "#8C8C8C" 63]; 64brights = [ 65"#444444" "#FF6D6D" "#89FF95" "#FFF484" 66"#97DDFF" "#FDAAF2" "#85F5DA" "#E9E9E9" 67]; 68background = "#1B1B1B"; 69cursor_bg = "#BEAF8A"; 70cursor_border = "#BEAF8A"; 71cursor_fg = "#1B1B1B"; 72foreground = "#BEAF8A"; 73selection_bg = "#444444"; 74selection_fg = "#E9E9E9"; 75}; 76'' ; 77description = '' 78Attribute set of additional color schemes to be written to 79{file}`$XDG_CONFIG_HOME/wezterm/colors`, where each key is 80taken as the name of the corresponding color scheme. See 81<https://wezfurlong.org/wezterm/config/appearance.html#defining-a-color-scheme-in-a-separate-file> 82for more details of the TOML color scheme format. 83'' ; 84}; 85 86enableBashIntegration = mkEnableOption "WezTerm's Bash integration" // { 87default = true ; 88}; 89 90enableZshIntegration = mkEnableOption "WezTerm's Zsh integration" // { 91default = true ; 92}; 93}; 94 95config = mkIf cfg . enable { 96home . packages = [ cfg . package ]; 97 98xdg . configFile = { 99"wezterm/wezterm.lua" . text = '' 100-- Generated by Home Manager. 101-- See https://wezfurlong.org/wezterm/ 102 103local wezterm = require 'wezterm'; 104 105${ cfg . extraConfig } 106'' ; 107} // mapAttrs' ( name :value : 108nameValuePair "wezterm/colors/ ${ name } .toml" { 109source = tomlFormat . generate " ${ name } .toml" { colors = value ; }; 110}) cfg . colorSchemes ; 111 112programs . bash . initExtra = 113mkIf cfg . enableBashIntegration shellIntegrationStr ; 114programs . zsh . initExtra = mkIf cfg . enableZshIntegration shellIntegrationStr ; 115}; 116}