mirror of
https://github.com/nix-community/home-manager
synced 2024-12-24 02:39:48 +01:00
wezterm: add module
This commit is contained in:
parent
91f26e0b0e
commit
d9e03b7f8c
9 changed files with 158 additions and 0 deletions
3
.github/CODEOWNERS
vendored
3
.github/CODEOWNERS
vendored
|
@ -289,6 +289,9 @@ Makefile @thiagokokada
|
|||
/modules/programs/waybar.nix @berbiche
|
||||
/tests/modules/programs/waybar @berbiche
|
||||
|
||||
/modules/programs/wezterm.nix @blmhemu
|
||||
/tests/modules/programs/wezterm @blmhemu
|
||||
|
||||
/modules/programs/xmobar.nix @t4ccer
|
||||
/tests/modules/programs/xmobar @t4ccer
|
||||
|
||||
|
|
|
@ -19,6 +19,12 @@
|
|||
githubId = 56743515;
|
||||
name = "Morgane Austreelis";
|
||||
};
|
||||
blmhemu = {
|
||||
name = "blmhemu";
|
||||
email = "19410501+blmhemu@users.noreply.github.com";
|
||||
github = "blmhemu";
|
||||
githubId = 19410501;
|
||||
};
|
||||
CarlosLoboxyz = {
|
||||
name = "Carlos Lobo";
|
||||
email = "86011416+CarlosLoboxyz@users.noreply.github.com";
|
||||
|
|
|
@ -639,6 +639,13 @@ in
|
|||
A new module is available: 'programs.hyfetch'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2022-08-07T09:07:35+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.wezterm'.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -173,6 +173,7 @@ let
|
|||
./programs/pywal.nix
|
||||
./programs/watson.nix
|
||||
./programs/waybar.nix
|
||||
./programs/wezterm.nix
|
||||
./programs/xmobar.nix
|
||||
./programs/z-lua.nix
|
||||
./programs/zathura.nix
|
||||
|
|
65
modules/programs/wezterm.nix
Normal file
65
modules/programs/wezterm.nix
Normal file
|
@ -0,0 +1,65 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.wezterm;
|
||||
|
||||
in {
|
||||
options.programs.wezterm = {
|
||||
enable = mkEnableOption "wezterm";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.wezterm;
|
||||
defaultText = literalExpression "pkgs.wezterm";
|
||||
description = "The Wezterm package to install.";
|
||||
};
|
||||
|
||||
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"},
|
||||
}
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
Extra configuration written to
|
||||
<filename>$XDG_CONFIG_HOME/wezterm/wezterm.lua</filename>. See
|
||||
<link xlink:href="https://wezfurlong.org/wezterm/config/files.html"/>
|
||||
how to configure.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
xdg.configFile."wezterm/wezterm.lua" = {
|
||||
text = ''
|
||||
-- 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}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
|
@ -114,6 +114,7 @@ import nmt {
|
|||
./modules/programs/topgrade
|
||||
./modules/programs/vscode
|
||||
./modules/programs/watson
|
||||
./modules/programs/wezterm
|
||||
./modules/programs/zplug
|
||||
./modules/programs/zsh
|
||||
./modules/xresources
|
||||
|
|
4
tests/modules/programs/wezterm/default.nix
Normal file
4
tests/modules/programs/wezterm/default.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
wezterm-example-setting = ./example-setting.nix;
|
||||
wezterm-empty-setting = ./empty-setting.nix;
|
||||
}
|
24
tests/modules/programs/wezterm/empty-setting.nix
Normal file
24
tests/modules/programs/wezterm/empty-setting.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.wezterm = { enable = true; };
|
||||
|
||||
test.stubs.wezterm = { };
|
||||
|
||||
nmt.script = let
|
||||
expected = builtins.toFile "wezterm.lua" ''
|
||||
-- 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)
|
||||
|
||||
return {}
|
||||
|
||||
'';
|
||||
in ''
|
||||
assertFileExists home-files/.config/wezterm/wezterm.lua
|
||||
assertFileContent home-files/.config/wezterm/wezterm.lua ${expected}
|
||||
'';
|
||||
}
|
47
tests/modules/programs/wezterm/example-setting.nix
Normal file
47
tests/modules/programs/wezterm/example-setting.nix
Normal file
|
@ -0,0 +1,47 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.wezterm = {
|
||||
enable = true;
|
||||
extraConfig = ''
|
||||
return {
|
||||
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"},
|
||||
}
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
test.stubs.wezterm = { };
|
||||
|
||||
nmt.script = let
|
||||
expected = builtins.toFile "wezterm.lua" ''
|
||||
-- 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)
|
||||
|
||||
return {
|
||||
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"},
|
||||
}
|
||||
}
|
||||
|
||||
'';
|
||||
in ''
|
||||
assertFileExists home-files/.config/wezterm/wezterm.lua
|
||||
assertFileContent home-files/.config/wezterm/wezterm.lua ${expected}
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue