refactor(home): extract shared wezterm module

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).
This commit is contained in:
Harald Hoyer 2026-04-27 09:47:46 +02:00
parent e20f5cfe71
commit 31df523787
4 changed files with 58 additions and 28 deletions

View file

@ -32,6 +32,10 @@
enable = true;
userEmail = "harald@subzero.xyz";
};
wezterm = {
enable = true;
term = "xterm-256color";
};
};
};

View file

@ -20,6 +20,10 @@
};
tools = {
git.enable = true;
wezterm = {
enable = true;
backgroundImage = ./terminal-background.png;
};
};
gui.kbd.ellipsis = true;
};
@ -71,18 +75,4 @@
xdg.enable = true;
xdg.mime.enable = true;
xdg.configFile."wezterm/wezterm.lua".text = ''
local wezterm = require("wezterm")
local config = wezterm.config_builder()
local act = wezterm.action
config.enable_kitty_keyboard = true
config.enable_scroll_bar = true
config.window_background_image = '${./terminal-background.png}'
config.term = 'wezterm'
return config
'';
}

View file

@ -20,6 +20,10 @@
};
tools = {
git.enable = true;
wezterm = {
enable = true;
backgroundImage = ./terminal-background.png;
};
};
gui.kbd.ellipsis = true;
};
@ -71,18 +75,4 @@
xdg.enable = true;
xdg.mime.enable = true;
xdg.configFile."wezterm/wezterm.lua".text = ''
local wezterm = require("wezterm")
local config = wezterm.config_builder()
local act = wezterm.action
config.enable_kitty_keyboard = true
config.enable_scroll_bar = true
config.window_background_image = '${./terminal-background.png}'
config.term = 'wezterm'
return config
'';
}

View file

@ -0,0 +1,46 @@
{
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
'';
};
}