mirror of
https://github.com/nix-community/home-manager.git
synced 2026-10-03 12:09:19 +00:00
Add a `settings` option that allows WezTerm to be configured
declaratively using a Nix attribute set. Settings are serialized to
Lua using `lib.generators.toLua`. Raw Lua expressions such as
`wezterm.font` and `wezterm.action.*` can be embedded using
`lib.generators.mkLuaInline`.
When `settings` is set, `extraConfig` is still supported. It is
wrapped in an immediately invoked function expression so that any
`return` statement (including the common `return {}` and
`return config` patterns) is captured and merged on top of the
generated settings, preserving full backward compatibility.
The merge between `settings` and `extraConfig` is shallow: a key
returned from `extraConfig` replaces the entire corresponding value
from `settings`, including nested tables and arrays.
Closes #6047
74 lines
1.7 KiB
Nix
74 lines
1.7 KiB
Nix
{ lib, ... }:
|
|
|
|
{
|
|
programs.wezterm = {
|
|
enable = true;
|
|
settings = {
|
|
color_scheme = "Catppuccin Mocha";
|
|
font_size = 13;
|
|
hide_tab_bar_if_only_one_tab = true;
|
|
window_padding = {
|
|
left = 0;
|
|
right = 0;
|
|
top = 0;
|
|
bottom = 0;
|
|
};
|
|
keys = [
|
|
{
|
|
key = "F11";
|
|
action = lib.generators.mkLuaInline "wezterm.action.ToggleFullScreen";
|
|
}
|
|
{
|
|
key = "+";
|
|
mods = "CTRL";
|
|
action = lib.generators.mkLuaInline "wezterm.action.IncreaseFontSize";
|
|
}
|
|
];
|
|
};
|
|
};
|
|
|
|
nmt.script =
|
|
let
|
|
expectedConfig = builtins.toFile "wezterm.lua" ''
|
|
-- Generated by Home Manager.
|
|
-- See https://wezfurlong.org/wezterm/
|
|
|
|
local wezterm = require 'wezterm'
|
|
local config = wezterm.config_builder and wezterm.config_builder() or {}
|
|
|
|
local hm_config = {
|
|
["color_scheme"] = "Catppuccin Mocha",
|
|
["font_size"] = 13,
|
|
["hide_tab_bar_if_only_one_tab"] = true,
|
|
["keys"] = {
|
|
{
|
|
["action"] = (wezterm.action.ToggleFullScreen),
|
|
["key"] = "F11"
|
|
},
|
|
{
|
|
["action"] = (wezterm.action.IncreaseFontSize),
|
|
["key"] = "+",
|
|
["mods"] = "CTRL"
|
|
}
|
|
},
|
|
["window_padding"] = {
|
|
["bottom"] = 0,
|
|
["left"] = 0,
|
|
["right"] = 0,
|
|
["top"] = 0
|
|
}
|
|
}
|
|
for k, v in pairs(hm_config) do
|
|
config[k] = v
|
|
end
|
|
|
|
|
|
return config
|
|
'';
|
|
in
|
|
''
|
|
assertFileExists home-files/.config/wezterm/wezterm.lua
|
|
assertFileContent home-files/.config/wezterm/wezterm.lua ${expectedConfig}
|
|
'';
|
|
}
|