Discord: Difference between revisions

From NixOS Wiki
imported>MathiasSven
m Add TTS section https://github.com/NixOS/nixpkgs/pull/224565
imported>Scrumplex
Add Vencord installation docs
Line 52: Line 52:
     myOverlay = self: super: {
     myOverlay = self: super: {
       discord = super.discord.override { withOpenASAR = true; };
       discord = super.discord.override { withOpenASAR = true; };
    };
  in
  [ myOverlay ];
</syntaxhighlight>
=== Vencord ===
Similarly to installing OpenAsar, you can install [https://github.com/Vendicated/Vencord Vencord] using an overlay:
<syntaxhighlight lang="nix">
nixpkgs.overlays =
  let
    myOverlay = self: super: {
      discord = super.discord.override { withVencord = true; };
    };
  in
  [ myOverlay ];
</syntaxhighlight>
You can also combine both OpenAsar and Vencord like this:
<syntaxhighlight lang="nix">
nixpkgs.overlays =
  let
    myOverlay = self: super: {
      discord = super.discord.override { withOpenASAR = true; withVencord = true; };
     };
     };
   in
   in

Revision as of 07:43, 22 June 2023

Note: This package is unfree and requires extra steps to install.

Installation

available builds

discord
discord-ptb
discord-canary

replace the discord below with whichever build you want

NixOS

nixpkgs.config = {
  allowUnfree = true;
};
environment.systemPackages = with pkgs; [ discord ]

Home Manager

Can be used on both NixOS and non-NixOS

Same as above but replace environment.systemPackages with home.packages

Non-NixOS

declarative package management on non-nixos

Usage

Command Line:

$ Discord

The nix expression also installs a desktop item as another option for starting the application.

Installing BetterDiscord

BetterDiscord is a client modification engine which allows you to use custom plugins, themes, and more. The easiest way to install this is using betterdiscordctl.

$ nix run nixpkgs#betterdiscordctl install

Join the NixOS Discord

Follow this link to join the unofficial NixOS Discord: https://discord.com/invite/RbvHtGa

OpenAsar

It's possible to use an overlay to install OpenAsar with nixpkgs' Discord:

nixpkgs.overlays =
  let
    myOverlay = self: super: {
      discord = super.discord.override { withOpenASAR = true; };
    };
  in
  [ myOverlay ];

Vencord

Similarly to installing OpenAsar, you can install Vencord using an overlay:

nixpkgs.overlays =
  let
    myOverlay = self: super: {
      discord = super.discord.override { withVencord = true; };
    };
  in
  [ myOverlay ];

You can also combine both OpenAsar and Vencord like this:

nixpkgs.overlays =
  let
    myOverlay = self: super: {
      discord = super.discord.override { withOpenASAR = true; withVencord = true; };
    };
  in
  [ myOverlay ];

Troubleshooting

Discord crashes when a notification is received

Discord crashes if there is no notification-daemon

standalone notification daemons

  • dunst — Lightweight and customizable notification daemon for x11
https://github.com/dunst-project/dunst || dunst
  • mako — A lightweight Wayland notification daemon
https://github.com/emersion/mako/ || mako

Discord wants latest version

Discord refuses to start because they have released an update and it wants to download that instead.

To prevent Discord from checking for new versions, add the following to ~/.config/discord/settings.json:

{
    "SKIP_HOST_UPDATE": true
}

If the file already exists the braces aren't necessary.


Alternatively, you can install the updated version.

If the version has already been updated in a newer version of nixpkgs, installing it works something like this:

nixpkgs.overlays = [(self: super: { discord = super.discord.overrideAttrs (_: { src = builtins.fetchTarball <link-to-tarball>; });})];

An overlay to build discord manually from the URL to the latest tarball on [1], see [2]

If it was fixed in master, the other alternatives are:

nix-env -f https://github.com/NixOS/nixpkgs/archive/release-20.09.tar.gz -iA discord

or with nix-shell:

NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs/archive/release-20.09.tar.gz nix-shell -p discord --run Discord

Opening Links with Firefox

If you use Discord and it silently fails to open links in Firefox, you possibly have encountered issue #78961. This is caused by a version mismatch between the NSS libraries used by Discord and Firefox. Luckily, a relatively easy workaround is available:

First, find out which NSS version Firefox is currently using with

$ nix path-info $(which firefox) -r | grep nss-

This should print a few store paths, focus on their ends, which should look like nss-x.xx. We're interested in the one with the newest version. Next, create a new file called discord_patched.nix and paste the following code into it:

with import <nixpkgs> {};

pkgs.discord.override {
    nss = pkgs.nss_3_49_2;
}

Now replace nss_3_49_2 with the previously looked up version's "attribute name", which you can look up here. Finally, build and install this patched package with

$ export NIXPKGS_ALLOW_UNFREE=1; nix-env -i $(nix-build discord_patched.nix) --arg config '{ allowUnfree = true; }'

Log in again and you should be able to open links properly.

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.

Text-to-Speech

TTS is disabled by default, you may enable it via an overlay

nixpkgs.overlays =
  let
    myOverlay = self: super: {
      discord = super.discord.override { withTTS = true; };
    };
  in
  [ myOverlay ];

Links

default.nix for discord