Change:
libXrender libXtst nspr <del> nss </del> libxcb pango libXScrnSaver

Discussion:
When using current NixOS 19.09 versions for Discord and Firefox, you cannot open links by clicking on them in Discord anymore. Run while having firefox open. Log in and attempt to open any link, or perform any interaction that would open a website in firefox. It will fail silently. For an error message, press ctrl-shift-i to bring up the inspector and type the following into the console: This will fail with an error message like This error message lead me to the assumption that a libnss version mismatch between Firefox and Discord is to blame, and indeed overriding the libnss version of the discord package to a newer one fixes the problem, so that a derivation built from the expression below can normally open links. This fix doesn't seem to have had any negative impact after a few days of running with it. system: host os: multi-user?: sandbox: version: channels(root): channels(cassidy): nixpkgs:
I believe, this has to do with how we are backporting the updates to non-ESR versions of the firefox. cc
Well, Firefox usually requires latest NSS on every update so we cannot really fix that. The issue is that  gets inherited by child processes like firefox. I do not see other solution than adding the libraries to every ELF executable using after stripping.
I don't know much about Discord's packaging but perhaps it would be possible to use instead of setting ?
will not work for ed libraries. Not sure what the ratio of linked/loaded libraries is.
The workaround above stopped working for me when Discord forced me to update the client to the latest version. I have tried plugging in various different nss pkgs, but none seem to make links work in the newest version. I also can't issue the commands from the OP to get an error message, when I open the inspector (in Discord?) I am unable to use in the console.
Huh, not working anymore seems to be related to the update. I updated Discord by waiting for nixpkgs to catch up and it still works fine for me, did you update by installing the offered by the forced-update dialogue?
After updating my nix channels and using and from nixos-19.09, I can confirm the workaround is still good.
I just opened a link from Discord with Firefox, in KDE. nixos-unstable.

This is still affecting 20.09; is necessary to get working links.
Seeing the same issue in , which is also Eletron
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
This affects 21.11 as of a couple of weeks ago, getting discord from stable or unstable. From my experience, it is all browsers. I also have Brave and Chromium, but couldn't get Discord to open links in those either. Using the override still functions, though.
Why not just add the correct nss to firefox's LDLIBRARYPATH so that it overrides the one from the environment? I did that in
Seeing this with too. I guess it's a potential issue for all applications with an dependency trying to open Firefox.
Have two open PRs trying to fix this in general (not just fixing firefox from discord), with slightly different approaches. Help making progress would be appreciated. - generic approach to swapping out xdg-open with something else, relies on programs picking it up from PATH or using an overlay and causing a lot of rebuilds - adds env var to xdg-open telling it to use the portal, and a config option to set it. Works for everything but needs to go via staging since it's a mass rebuild and doesn't help users who in general want to swap out xdg-open for something else, which is maybe less important. Does not help for opening files, only URLs.