Add a `metacfg.tools.wezterm` home-manager module so wezterm.lua configuration can be reused across hosts instead of being duplicated inline. Migrate halo and amd to the new module and enable it on rialo (font size 14, term = xterm-256color).
46 lines
1.3 KiB
Nix
46 lines
1.3 KiB
Nix
{
|
|
lib,
|
|
config,
|
|
...
|
|
}:
|
|
|
|
let
|
|
inherit (lib)
|
|
types
|
|
mkEnableOption
|
|
mkIf
|
|
optionalString
|
|
boolToString
|
|
;
|
|
inherit (lib.metacfg) mkOpt mkBoolOpt;
|
|
|
|
cfg = config.metacfg.tools.wezterm;
|
|
in
|
|
{
|
|
options.metacfg.tools.wezterm = {
|
|
enable = mkEnableOption "wezterm config";
|
|
fontSize = mkOpt types.int 14 "Font size for wezterm.";
|
|
enableKittyKeyboard = mkBoolOpt true "Enable the kitty keyboard protocol.";
|
|
enableScrollBar = mkBoolOpt true "Enable the scroll bar.";
|
|
backgroundImage = mkOpt (types.nullOr types.path) null "Path to a window background image.";
|
|
term = mkOpt types.str "wezterm" "Value to set for `config.term`.";
|
|
extraConfig = mkOpt types.lines "" "Extra Lua appended before `return config`.";
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
xdg.configFile."wezterm/wezterm.lua".text = ''
|
|
local wezterm = require("wezterm")
|
|
local config = wezterm.config_builder()
|
|
|
|
config.enable_kitty_keyboard = ${boolToString cfg.enableKittyKeyboard}
|
|
config.enable_scroll_bar = ${boolToString cfg.enableScrollBar}
|
|
${optionalString (
|
|
cfg.backgroundImage != null
|
|
) "config.window_background_image = '${cfg.backgroundImage}'"}
|
|
config.font_size = ${toString cfg.fontSize}
|
|
config.term = '${cfg.term}'
|
|
${cfg.extraConfig}
|
|
return config
|
|
'';
|
|
};
|
|
}
|