marleyos/modules/home/programs/wezterm/default.nix

90 lines
2.1 KiB
Nix
Raw Normal View History

2024-11-16 21:10:07 -08:00
{
lib,
config,
system,
2024-11-16 21:10:07 -08:00
pkgs,
...
2025-01-09 08:08:30 -08:00
}: let
inherit (lib.snowfall.system) is-darwin;
2024-11-16 21:10:07 -08:00
cfg = config.marleyos.programs.wezterm;
2024-11-16 21:10:07 -08:00
isGenericLinux = config.targets.genericLinux.enable;
isNotNixOS = isGenericLinux || (is-darwin system);
theme =
if config.rose-pine.enable
then "rose-pine"
else "";
2025-01-09 08:08:30 -08:00
in {
2025-01-12 12:12:40 -08:00
options.marleyos.programs.wezterm.enable = lib.mkEnableOption "wezterm";
2024-11-16 21:10:07 -08:00
2025-01-12 12:12:40 -08:00
config = lib.mkIf cfg.enable {
2024-11-16 21:10:07 -08:00
programs.wezterm = {
enable = true;
2024-11-22 21:38:01 -08:00
# Generic linux: NixGL makes Wezterm shit the bed for some reason.
# macOS: Prefer brew cask so a proper Applications shortcut is made.
2025-01-09 08:08:30 -08:00
package =
if isNotNixOS
then pkgs.emptyDirectory
else pkgs.wezterm;
2024-11-16 21:10:07 -08:00
# TODO: create `local config` & return it seperately, so other modules can
# insert config in the middle
2025-01-09 08:08:30 -08:00
extraConfig = let
2025-01-12 12:12:40 -08:00
inherit (config.marleyos.theme) fonts;
2025-01-09 08:08:30 -08:00
in
2024-11-16 21:10:07 -08:00
# lua
''
local config = wezterm.config_builder()
2025-01-09 08:08:30 -08:00
-- Fix color blocks instead of text issue.
config.front_end = "WebGpu"
2024-11-16 21:10:07 -08:00
config.enable_tab_bar = false
config.color_scheme = "${theme}"
2024-11-16 21:10:07 -08:00
config.font = wezterm.font_with_fallback({
{
2025-01-12 12:12:40 -08:00
family = "${fonts.monospace.name}",
2024-11-16 21:10:07 -08:00
harfbuzz_features = {
2025-01-12 12:12:40 -08:00
${lib.concatStrings fonts.monospace.ligatures}
2024-11-16 21:10:07 -08:00
}
},
{ family = "FairiesevkaTerm Nerd Font Mono" },
{
family = "FiraCode Nerd Font",
harfbuzz_features = {
"cv02",
"cv06",
"ss01",
"cv14",
"onum",
"ss04",
"cv18",
"cv31",
"cv30",
"cv25",
"cv26",
"cv32",
"ss06",
"ss07",
},
},
2025-01-12 12:12:40 -08:00
{ family = "${fonts.emoji.name}" },
2024-11-16 21:10:07 -08:00
})
2025-01-09 08:08:30 -08:00
config.font_size = ${
if (is-darwin system)
then "14.0"
else "11.0"
}
2024-11-16 21:10:07 -08:00
return config
'';
};
};
}