{
  pkgs,
  lib,
  config,
  ...
}:
with lib; let
  cfg = config.local.apps.halloy;
in {
  options.local.apps.halloy = {
    enable = mkEnableOption "halloy irc client";
  };
  config = mkIf cfg.enable {
    programs.halloy = {
      enable = true;
      settings = {
        theme = "macawCustom";
        preview.enabled = false;
        sidebar = {
          buffer_action = "replace-pane";
          focused_buffer_action = "close-pane";
        };
        buffer = {
          channel.topic = {
            enabled = true;
          };
          chathistory.infinite_scroll = true;
          server_messages = {
            join.exclude = ["*"];
            quit.exclude = ["*"];
          };
        };

        servers.liberachat = {
          nickname = "posixlycorrect";
          nick_password_command = "pass show liberachat_irc";

          username = "fabiansoju/irc.libera.chat";
          password_command = "pass show soju";

          server = "soju.posixlycorrect.com";
          port = 6697;
          chathistory = true;
          channels = [
            "#lobsters"
            "#nixos"
            "#linux"
            "##rust"
            "#git"
            "#c"
            "##programming"
            "#hardware"
            "##chat"
            "#OSRS"
            "##math"
            "##physics"
            "#haskell"
            "#soju"
            "#datahoarder"
            "#startrek"
          ];
        };
      };
      themes = {
        macawCustom = {
          general = {
            background = "#333333";
            border = "#505050";
            horizontal_rule = "#333333";
            unread_indicator = "#2884FC";
          };

          text = {
            primary = "#DFDFDF";
            secondary = "#C2C2C2";
            tertiary = "#8839EF";
            success = "#959595";
            error = "#959595";
          };

          buffer = {
            action = "#959595";
            background = "#1E1E1E";
            background_text_input = "#2E2E2E";
            background_title_bar = "#2E2E2E";
            border = "#1A1A1A";
            border_selected = "#1A1A1A";
            code = "#7287FD";
            highlight = "#454645";
            nickname = "#00C8FF";
            selection = "#777777";
            timestamp = "#959595";
            topic = "#DFDFDF";
            url = "#2884FC";
            buffer.server_messages = {
              default = "#959595";
            };
          };

          buttons.primary = {
            background = "#00000000";
            background_hover = "#484848";
            background_selected = "#4A4A4A";
            background_selected_hover = "#666666";
          };

          buttons.secondary = {
            background = "#3B3B3B";
            background_hover = "#484848";
            background_selected = "#646464";
            background_selected_hover = "#666666";
          };
        };
      };
    };
  };
}
