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

85 lines
2.1 KiB
Nix

{
lib,
config,
system,
pkgs,
...
}: let
inherit (lib.snowfall.system) is-darwin;
cfg = config.marleyos.programs.wezterm;
inherit (config.marleyos.theme) colors;
isGenericLinux = config.targets.genericLinux.enable;
isNotNixOS = isGenericLinux || (is-darwin system);
in {
options.marleyos.programs.wezterm.enable = lib.mkEnableOption "wezterm";
config = lib.mkIf cfg.enable {
programs.wezterm = {
enable = true;
# Generic linux: NixGL makes Wezterm shit the bed for some reason.
# macOS: Prefer brew cask so a proper Applications shortcut is made.
package =
if isNotNixOS
then pkgs.emptyDirectory
else pkgs.wezterm;
# TODO: create `local config` & return it seperately, so other modules can
# insert config in the middle
extraConfig = let
inherit (config.marleyos.theme) fonts;
in
# lua
''
local config = wezterm.config_builder()
-- Fix color blocks instead of text issue.
config.front_end = "WebGpu"
config.enable_tab_bar = false
config.color_scheme = "${colors.base}"
config.font = wezterm.font_with_fallback({
{
family = "${fonts.monospace.name}",
harfbuzz_features = {
${lib.concatStrings fonts.monospace.ligatures}
}
},
{ 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",
},
},
{ family = "${fonts.emoji.name}" },
})
config.font_size = ${
if (is-darwin system)
then "14.0"
else "11.0"
}
return config
'';
};
};
}