2022-04-08 08:48:27 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.programs.wezterm;
|
2022-08-11 11:21:24 +02:00
|
|
|
tomlFormat = pkgs.formats.toml { };
|
2022-04-08 08:48:27 +02:00
|
|
|
|
2023-06-05 22:46:18 +02:00
|
|
|
shellIntegrationStr = ''
|
|
|
|
source "${cfg.package}/etc/profile.d/wezterm.sh"
|
|
|
|
'';
|
|
|
|
|
2022-04-08 08:48:27 +02:00
|
|
|
in {
|
2023-05-14 12:40:31 +02:00
|
|
|
meta.maintainers = [ hm.maintainers.blmhemu ];
|
|
|
|
|
2022-04-08 08:48:27 +02:00
|
|
|
options.programs.wezterm = {
|
2023-07-02 01:45:18 +02:00
|
|
|
enable = mkEnableOption "wezterm";
|
2022-04-08 08:48:27 +02:00
|
|
|
|
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
default = pkgs.wezterm;
|
|
|
|
defaultText = literalExpression "pkgs.wezterm";
|
2023-07-02 01:45:18 +02:00
|
|
|
description = "The Wezterm package to install.";
|
2022-04-08 08:48:27 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
extraConfig = mkOption {
|
|
|
|
type = types.lines;
|
|
|
|
default = ''
|
|
|
|
return {}
|
|
|
|
'';
|
|
|
|
example = literalExpression ''
|
|
|
|
-- Your lua code / config here
|
|
|
|
local mylib = require 'mylib';
|
|
|
|
return {
|
|
|
|
usemylib = mylib.do_fun();
|
|
|
|
font = wezterm.font("JetBrains Mono"),
|
|
|
|
font_size = 16.0,
|
|
|
|
color_scheme = "Tomorrow Night",
|
|
|
|
hide_tab_bar_if_only_one_tab = true,
|
|
|
|
default_prog = { "zsh", "--login", "-c", "tmux attach -t dev || tmux new -s dev" },
|
|
|
|
keys = {
|
|
|
|
{key="n", mods="SHIFT|CTRL", action="ToggleFullScreen"},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
'';
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2022-04-08 08:48:27 +02:00
|
|
|
Extra configuration written to
|
2023-07-01 01:30:13 +02:00
|
|
|
{file}`$XDG_CONFIG_HOME/wezterm/wezterm.lua`. See
|
|
|
|
<https://wezfurlong.org/wezterm/config/files.html>
|
2022-04-08 08:48:27 +02:00
|
|
|
how to configure.
|
|
|
|
'';
|
|
|
|
};
|
2022-08-11 11:21:24 +02:00
|
|
|
|
|
|
|
colorSchemes = mkOption {
|
|
|
|
type = types.attrsOf (tomlFormat.type);
|
|
|
|
default = { };
|
|
|
|
example = literalExpression ''
|
|
|
|
myCoolTheme = {
|
|
|
|
ansi = [
|
|
|
|
"#222222" "#D14949" "#48874F" "#AFA75A"
|
|
|
|
"#599797" "#8F6089" "#5C9FA8" "#8C8C8C"
|
|
|
|
];
|
|
|
|
brights = [
|
|
|
|
"#444444" "#FF6D6D" "#89FF95" "#FFF484"
|
|
|
|
"#97DDFF" "#FDAAF2" "#85F5DA" "#E9E9E9"
|
|
|
|
];
|
|
|
|
background = "#1B1B1B";
|
|
|
|
cursor_bg = "#BEAF8A";
|
|
|
|
cursor_border = "#BEAF8A";
|
|
|
|
cursor_fg = "#1B1B1B";
|
|
|
|
foreground = "#BEAF8A";
|
|
|
|
selection_bg = "#444444";
|
|
|
|
selection_fg = "#E9E9E9";
|
|
|
|
};
|
|
|
|
'';
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2022-08-11 11:21:24 +02:00
|
|
|
Attribute set of additional color schemes to be written to
|
2023-07-01 01:30:13 +02:00
|
|
|
{file}`$XDG_CONFIG_HOME/wezterm/colors`, where each key is
|
2022-08-11 11:21:24 +02:00
|
|
|
taken as the name of the corresponding color scheme. See
|
2023-07-01 01:30:13 +02:00
|
|
|
<https://wezfurlong.org/wezterm/config/appearance.html#defining-a-color-scheme-in-a-separate-file>
|
2022-08-11 11:21:24 +02:00
|
|
|
for more details of the TOML color scheme format.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2023-07-02 01:45:18 +02:00
|
|
|
enableBashIntegration = mkEnableOption "WezTerm's Bash integration" // {
|
|
|
|
default = true;
|
|
|
|
};
|
2023-06-05 22:46:18 +02:00
|
|
|
|
2023-07-02 01:45:18 +02:00
|
|
|
enableZshIntegration = mkEnableOption "WezTerm's Zsh integration" // {
|
|
|
|
default = true;
|
|
|
|
};
|
2022-04-08 08:48:27 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
home.packages = [ cfg.package ];
|
|
|
|
|
2022-08-11 11:21:24 +02:00
|
|
|
xdg.configFile = {
|
|
|
|
"wezterm/wezterm.lua".text = ''
|
2022-04-08 08:48:27 +02:00
|
|
|
-- Generated by Home Manager.
|
|
|
|
-- See https://wezfurlong.org/wezterm/
|
|
|
|
|
|
|
|
-- Add config folder to watchlist for config reloads.
|
|
|
|
local wezterm = require 'wezterm';
|
|
|
|
wezterm.add_to_config_reload_watch_list(wezterm.config_dir)
|
|
|
|
|
|
|
|
${cfg.extraConfig}
|
|
|
|
'';
|
2022-08-11 11:21:24 +02:00
|
|
|
} // mapAttrs' (name: value:
|
|
|
|
nameValuePair "wezterm/colors/${name}.toml" {
|
|
|
|
source = tomlFormat.generate "${name}.toml" { colors = value; };
|
|
|
|
}) cfg.colorSchemes;
|
2023-06-05 22:46:18 +02:00
|
|
|
|
|
|
|
programs.bash.initExtra =
|
|
|
|
mkIf cfg.enableBashIntegration shellIntegrationStr;
|
|
|
|
programs.zsh.initExtra = mkIf cfg.enableZshIntegration shellIntegrationStr;
|
2022-04-08 08:48:27 +02:00
|
|
|
};
|
|
|
|
}
|