{ inputs, ... }: {
  flake.homeManagerModules.wisdomAppsDiscord =
    { config, lib, pkgs, ... }:
    let
      root = config.chiasson.home;
      cfg = config.chiasson.home.apps.discord;
      # nixcord still pulls `discord` on some paths; that package is not built for aarch64-linux.
      nixcordSupported = lib.meta.availableOn pkgs.stdenv.hostPlatform pkgs.discord;
    in
    {
      imports = [ inputs.nixcord.homeModules.default ];

      options.chiasson.home.apps.discord.enable = lib.mkEnableOption ''
        Vesktop (nixcord). Needs nixpkgs `discord` — breaks on e.g. aarch64-linux.
      '' // {
        default = false;
      };

      config = lib.mkIf root.enable (lib.mkMerge [
        {
          assertions = lib.mkIf cfg.enable [
            {
              assertion = nixcordSupported;
              message = "chiasson.home.apps.discord uses nixcord, which currently requires nixpkgs `discord` (not available on ${pkgs.stdenv.hostPlatform.system}). Disable `chiasson.home.apps.discord` on this host.";
            }
          ];
        }
        (lib.mkIf (cfg.enable && nixcordSupported) {
          programs.nixcord = {
            enable = true;
            vesktop.enable = true;
            dorion.enable = false;
            config = {
              useQuickCss = true;
              transparent = true;
              enabledThemes = lib.optionals (
                lib.attrByPath [ "programs" "dank-material-shell" "enable" ] false config
              ) [ "dank-discord.css" ];
              plugins = {
                showHiddenChannels = {
                  enable = true;
                  showMode = 0;
                };
                platformIndicators.enable = true;
              };
            };
          };
        })
      ]);
    };
}
