{
  lib,
  config,
  system,
  pkgs,
  ...
}: let
  inherit (lib.snowfall.system) is-darwin;

  cfg = config.marleyos.programs.wezterm;

  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 =
        # lua
        ''
          local config = wezterm.config_builder()

          -- Fix color blocks instead of text issue.
          config.front_end = "WebGpu"

          config.freetype_load_flags = 'NO_HINTING'

          config.enable_tab_bar = false

          return config
        '';
    };
  };
}
