Discord: Difference between revisions
DontEatOreo (talk | contribs) Add Krisp noise suppression Workaround |
m Add information about Wayland screen sharing with Discord Canary |
||
Line 79: | Line 79: | ||
== Troubleshooting == | == Troubleshooting == | ||
=== | === Screen sharing on Wayland === | ||
Discord | Since December 2024, Discord Canary supports screen sharing on Wayland. Alternatively, you can use the web version on a browser that supports screen sharing on Wayland, or an [[Discord#Unofficial Clients|unofficial client]] like ''Webcord'' or ''Vesktop'', both of which have fixed this issue in their own ways. | ||
{{Note|Remember to configure an [https://wiki.archlinux.org/title/XDG_Desktop_Portal#List_of_backends_and_interfaces XDG Desktop Portal] with screen cast capabilities!}} | {{Note|Remember to configure an [https://wiki.archlinux.org/title/XDG_Desktop_Portal#List_of_backends_and_interfaces XDG Desktop Portal] with screen cast capabilities!}} | ||
Latest revision as of 12:09, 10 December 2024
Discord is an instant messaging and VoIP application with lots of functionality. It provides a web interface, though most users would prefer to use a client for interoperability with their system.
Installation
Official Clients
Nixpkgs provides all three of Discord's release channels, accessible as pkgs.discord
, pkgs.discord-ptb
, and pkgs.discord-canary
respectively. Add any of the previous derivations to your package's configuration. For NixOS this will be in environment.systemPackages
or users.users.<name>.packages
.
# configuration.nix
{ config, lib, pkgs, ... }: {
# This will install Discord PTB for all users of the system
environment.systemPackages = with pkgs; [
discord-ptb
];
# This installs Discord PTB only for the user "alice"
users.users.alice.packages = with pkgs; [
discord-ptb
];
}
Unofficial Clients
Nixpkgs also provides a vast variety of community developed/modded Discord clients, which can usually serve as drop-in replacements for the official discord client with an extended set of features.
Legcord (formerly ArmCord)[1]
Lightweight, alternative desktop client with built-in modding extensibility. Nixpkgs provides this client via pkgs.legcord
.
{ config, lib, pkgs, ... }: {
environment.systemPackages = with pkgs; [
legcord
];
}
BetterDiscord[2]
Enhances Discord desktop app with new features. Nixpkgs provides the installer via pkgs.betterdiscordctl
. This can be added to your configuration, though users may prefer to instead run it one-off via the Nix cli.
$ nix-shell -p betterdiscordctl --command 'betterdiscordctl install' # nix-legacy
$ nix run nixpkgs#betterdiscordctl -- install # nix3
$ nix-shell -p betterdiscordctl --command 'betterdiscordctl self-upgrade' # nix-legacy
$ nix run nixpkgs#betterdiscordctl -- self-upgrade # nix3
OpenAsar[3]
Open-source alternative to Discord's app.asar
. Nixpkgs provides this via pkgs.openasar
, though this doesn't provide a usable client. Users should instead prefer overriding the official discord package and add withOpenASAR = true
.
{ config, lib, pkgs, ... }: {
environment.systemPackages = with pkgs; [
(discord.override {
withOpenASAR = true;
# withVencord = true; # can do this here too
})
];
}
Vencord[4]
The cutest Discord client mod. Nixpkgs provides their custom client Vesktop viapkgs.vesktop
, or as an override for the official discord package via withVencord = true
.
{ config, lib, pkgs, ... }: {
environment.systemPackages = with pkgs; [
# vesktop # If you prefer this
(discord.override {
# withOpenASAR = true; # can do this here too
withVencord = true;
})
];
}
Webcord[5]
Discord and Spacebar client implemented without using the official Discord API. Nixpkgs provides this client via pkgs.webcord
.
{ config, lib, pkgs, ... }: {
environment.systemPackages = with pkgs; [
webcord
];
}
Troubleshooting
Screen sharing on Wayland
Since December 2024, Discord Canary supports screen sharing on Wayland. Alternatively, you can use the web version on a browser that supports screen sharing on Wayland, or an unofficial client like Webcord or Vesktop, both of which have fixed this issue in their own ways.
Notifications causing crashes
Discord will crash if there is no compatible notification daemon running. This issue is only prevalent in custom desktop environments, such as Sway or Hyprland. Comprehensive documentation usually exists for most window managers/compositors and can be found on their respective wikis. Nixpkgs provides a few standalone notification daemons such as pkgs.dunst
and pkgs.mako
. You may optionally use a notification daemon from a larger DE, such as pkgs.lxqt.lxqt-notificationd
, however it is unclear how effective these will be outside of their normal environment.
{ config, lib, pkgs, ... }: {
# You will need to add a call for the daemon to actually function.
# This is usually done within the configuration of your respective WM.
# See the official wiki/documentation for your WM for more info.
environment.systemPackages = with pkgs; [
mako
];
}
"Must be your lucky day" popup
Although Nixpkgs is usually very fast with updates (if you use nixos-unstable), you may still run into this issue intermittently. You may override the discord package with a more up-to-date source, or you may disable this popup entirely by adding "SKIP_HOST_UPDATE": true
to ~/.config/discord/settings.json
.
~/.config/discord/settings.json
{
"SKIP_HOST_UPDATE": true
}
Krisp noise suppression
The Krisp noise suppression option will not work on NixOS because the Discord binary is patched before installation, and there is a DRM-style integrity check in the Krisp binary which prevents Krisp from working if the Discord binary is modified. See https://github.com/NixOS/nixpkgs/issues/195512 for details.
Python Script Workaround
One way to enable Krisp noise suppression is by patching the discord_krisp.node
binary to bypass its DRM verification. Below is a Nix configuration that creates a Python script that patches the binary by modifying specific bytes to bypass the license check:
{ pkgs, ... }:
let
krisp-patcher =
pkgs.writers.writePython3Bin "krisp-patcher"
{
libraries = with pkgs.python3Packages; [
capstone
pyelftools
];
flakeIgnore = [
"E501" # line too long (82 > 79 characters)
"F403" # 'from module import *' used; unable to detect undefined names
"F405" # name may be undefined, or defined from star imports: module
];
}
(
builtins.readFile (
pkgs.fetchurl {
url = "https://pastebin.com/raw/8tQDsMVd";
sha256 = "sha256-IdXv0MfRG1/1pAAwHLS2+1NESFEz2uXrbSdvU9OvdJ8=";
}
)
);
in
{
environment.systemPackages = [
krisp-patcher
];
}
After adding this to your Nix configuration and rebuilding, make sure Discord is completely closed, and then run:
$ krisp-patcher ~/.config/discord/0.0.76/modules/discord_krisp/discord_krisp.node
Once you restart Discord and join a VC, you should see a sound wave icon to the left of the hangup icon.
Text-to-Speech
TTS is disabled by default; you may enable it via an override:
(pkgs.discord.override { withTTS = true; })