wezterm: add module

This commit is contained in:
Hemanth Bollamreddi 2022-04-08 12:18:27 +05:30 committed by Robert Helgesson
parent 91f26e0b0e
commit d9e03b7f8c
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
9 changed files with 158 additions and 0 deletions

3
.github/CODEOWNERS vendored
View file

@ -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

View file

@ -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";

View file

@ -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'.
'';
}
];
};
}

View file

@ -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

View 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}
'';
};
};
}

View file

@ -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

View file

@ -0,0 +1,4 @@
{
wezterm-example-setting = ./example-setting.nix;
wezterm-empty-setting = ./empty-setting.nix;
}

View 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}
'';
}

View 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}
'';
}