nixpkgs/pkgs/applications/networking/instant-messengers/discord/default.nix
Will Dietz 8753b10808 discord: fix "corrupt install" warnings, misc cleanup
Few things:
* Discord binary has RUNPATH not RPATH set
* patchelf uses RUNPATH if it already exits, so deps end up in RUNPATH
* RUNPATH isn't searched for plugins or transitive deps
* ..badness results

Despite this, it currently seems to work-- with the caveat
that it has a little bar on top complaining about how
"it looks like your installation is corrupt".

This fixes that warning and does some minor cleanup.
2018-01-10 22:12:06 -08:00

63 lines
2.2 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{ stdenv, fetchurl, makeDesktopItem, makeWrapper
, alsaLib, atk, cairo, cups, dbus, expat, fontconfig, freetype, gdk_pixbuf
, glib, gnome2, gtk2, libnotify, libX11, libXcomposite, libXcursor, libXdamage
, libXext, libXfixes, libXi, libXrandr, libXrender, libXtst, nspr, nss, libxcb
, pango, systemd, libXScrnSaver, libcxx, libpulseaudio }:
stdenv.mkDerivation rec {
pname = "discord";
version = "0.0.4";
name = "${pname}-${version}";
src = fetchurl {
url = "https://cdn.discordapp.com/apps/linux/${version}/${pname}-${version}.tar.gz";
sha256 = "1alw9rkv1vv0s1w33hd9ab1cgj7iqd7ad9kvn1d55gyki28f8qlb";
};
nativeBuildInputs = [ makeWrapper ];
libPath = stdenv.lib.makeLibraryPath [
libcxx systemd libpulseaudio
stdenv.cc.cc alsaLib atk cairo cups dbus expat fontconfig freetype
gdk_pixbuf glib gnome2.GConf gtk2 libnotify libX11 libXcomposite
libXcursor libXdamage libXext libXfixes libXi libXrandr libXrender
libXtst nspr nss libxcb pango systemd libXScrnSaver
];
installPhase = ''
mkdir -p $out/{bin,opt/discord,share/pixmaps}
mv * $out/opt/discord
patchelf --set-interpreter ${stdenv.cc.bintools.dynamicLinker} \
$out/opt/discord/Discord
paxmark m $out/opt/discord/Discord
wrapProgram $out/opt/discord/Discord --prefix LD_LIBRARY_PATH : ${libPath}
ln -s $out/opt/discord/Discord $out/bin/
ln -s $out/opt/discord/discord.png $out/share/pixmaps
ln -s "${desktopItem}/share/applications" $out/share/
'';
desktopItem = makeDesktopItem {
name = pname;
exec = "Discord";
icon = pname;
desktopName = "Discord";
genericName = meta.description;
categories = "Network;InstantMessaging;";
};
meta = with stdenv.lib; {
description = "All-in-one voice and text chat for gamers thats free, secure, and works on both your desktop and phone";
homepage = https://discordapp.com/;
downloadPage = "https://github.com/crmarsh/discord-linux-bugs";
license = licenses.unfree;
maintainers = [ maintainers.ldesgoui maintainers.MP2E ];
platforms = [ "x86_64-linux" ];
};
}