{ config, lib, pkgs, ... }:

let cfg = config.sydnix.users.crumb.discord;
in {
  options.sydnix.users.crumb.discord = {
    enable = lib.mkEnableOption "Discord";
  };

  config = lib.mkIf cfg.enable {
    sydnix.discord.enable = true;

    programs.nixcord = {
      config = {
        themeLinks = [
          # Compact++ (Default) — Themes Discord to look more like a typical IRC
          # client.
          "https://gitlab.com/api/v4/projects/52800868/snippets/3628352/files/main/compactplusplus-default.theme.css/raw"
        ];
        plugins = {
          ircColors.enable = true;
        };
      };
      vesktop = {
        state.firstLaunch = false;
        settings = {
          discordBranch = "canary";
          minimizeToTray = false;
          arRPC = true;
        };
      };
    };
  };
}
