nixpkgs/pkgs/applications/networking/instant-messengers/discord/base.nix

85 lines
2.7 KiB
Nix
Raw Normal View History

{ pname, version, src, binaryName, desktopName
2021-04-19 00:16:42 +00:00
, autoPatchelfHook, makeDesktopItem, lib, stdenv, wrapGAppsHook
, alsa-lib, at-spi2-atk, at-spi2-core, atk, cairo, cups, dbus, expat, fontconfig
, freetype, gdk-pixbuf, glib, gtk3, libcxx, libdrm, libnotify, libpulseaudio, libuuid
, libX11, libXScrnSaver, libXcomposite, libXcursor, libXdamage, libXext
2021-06-04 18:23:34 +00:00
, libXfixes, libXi, libXrandr, libXrender, libXtst, libxcb, libxshmfence
, mesa, nspr, nss, pango, systemd, libappindicator-gtk3, libdbusmenu
}:
let
inherit binaryName;
in stdenv.mkDerivation rec {
inherit pname version src;
nativeBuildInputs = [
alsa-lib
autoPatchelfHook
cups
libdrm
libuuid
libXdamage
libX11
libXScrnSaver
libXtst
libxcb
2021-06-04 18:23:34 +00:00
libxshmfence
2021-05-25 20:22:50 +00:00
mesa
nss
wrapGAppsHook
];
dontWrapGApps = true;
2021-01-15 05:42:41 +00:00
libPath = lib.makeLibraryPath [
2021-05-25 20:22:50 +00:00
libcxx systemd libpulseaudio libdrm mesa
stdenv.cc.cc alsa-lib atk at-spi2-atk at-spi2-core cairo cups dbus expat fontconfig freetype
2019-05-22 11:03:39 +00:00
gdk-pixbuf glib gtk3 libnotify libX11 libXcomposite libuuid
libXcursor libXdamage libXext libXfixes libXi libXrandr libXrender
libXtst nspr nss libxcb pango systemd libXScrnSaver
libappindicator-gtk3 libdbusmenu
];
installPhase = ''
mkdir -p $out/{bin,opt/${binaryName},share/pixmaps}
mv * $out/opt/${binaryName}
chmod +x $out/opt/${binaryName}/${binaryName}
patchelf --set-interpreter ${stdenv.cc.bintools.dynamicLinker} \
$out/opt/${binaryName}/${binaryName}
wrapProgram $out/opt/${binaryName}/${binaryName} \
"''${gappsWrapperArgs[@]}" \
--prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}/" \
2021-05-25 20:22:50 +00:00
--prefix LD_LIBRARY_PATH : ${libPath}:$out/opt/${binaryName}
ln -s $out/opt/${binaryName}/${binaryName} $out/bin/
# Without || true the install would fail on case-insensitive filesystems
ln -s $out/opt/${binaryName}/${binaryName} $out/bin/${lib.strings.toLower binaryName} || true
ln -s $out/opt/${binaryName}/discord.png $out/share/pixmaps/${pname}.png
ln -s "${desktopItem}/share/applications" $out/share/
'';
desktopItem = makeDesktopItem {
name = pname;
exec = binaryName;
icon = pname;
inherit desktopName;
genericName = meta.description;
categories = "Network;InstantMessaging;";
mimeType = "x-scheme-handler/discord";
};
passthru.updateScript = ./update-discord.sh;
meta = with lib; {
description = "All-in-one cross-platform voice and text chat for gamers";
homepage = "https://discordapp.com/";
downloadPage = "https://discordapp.com/download";
license = licenses.unfree;
maintainers = with maintainers; [ ldesgoui MP2E ];
platforms = [ "x86_64-linux" ];
};
}