Discord: Difference between revisions
imported>Mzero m fix syntax in example |
imported>Legendofmiracles m fixes a typo |
||
Line 93: | Line 93: | ||
Now replace <code>nss_3_49_2</code> with the previously looked up version's "attribute name", which you can look up [https://search.nixos.org/packages/?query=nss_ here]. Finally, build and install this patched package with | Now replace <code>nss_3_49_2</code> with the previously looked up version's "attribute name", which you can look up [https://search.nixos.org/packages/?query=nss_ here]. Finally, build and install this patched package with | ||
<syntaxhighlight lang="console"> | <syntaxhighlight lang="console"> | ||
$ nix-env -i $(nix build discord_patched.nix) --arg config '{ allowUnfree = true; }' | $ nix-env -i $(nix-build discord_patched.nix) --arg config '{ allowUnfree = true; }' | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 20:47, 16 May 2021
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.
Join the NixOS Discord
Follow this link to join the unofficial NixOS Discord: https://discord.com/invite/RbvHtGa
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
- mako — A lightweight Wayland notification daemon
Discord wants latest version
Discord refuses to start because they have released an update and only the latest version can connect to their service.
Most of the time this is a temporary problem, and you can just wait for the version to be bumped in nixpkgs and update then. For the impatient the workaround is 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
$ nix-env -i $(nix-build discord_patched.nix) --arg config '{ allowUnfree = true; }'
Log in again and you should be able to open links properly.