2019-06-19 05:39:15 +00:00
|
|
|
{ pname, version, src, binaryName, desktopName
|
2021-04-19 00:16:42 +00:00
|
|
|
, autoPatchelfHook, makeDesktopItem, lib, stdenv, wrapGAppsHook
|
2021-06-10 02:57:09 +00:00
|
|
|
, alsa-lib, at-spi2-atk, at-spi2-core, atk, cairo, cups, dbus, expat, fontconfig
|
2020-06-09 04:37:12 +00:00
|
|
|
, 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
|
2020-10-11 19:14:59 +00:00
|
|
|
, mesa, nspr, nss, pango, systemd, libappindicator-gtk3, libdbusmenu
|
2021-07-15 20:14:41 +00:00
|
|
|
, writeScript, common-updater-scripts
|
2020-06-09 04:37:12 +00:00
|
|
|
}:
|
2019-06-19 05:39:15 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
inherit binaryName;
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
inherit pname version src;
|
|
|
|
|
2020-06-09 04:37:12 +00:00
|
|
|
nativeBuildInputs = [
|
2021-06-10 02:57:09 +00:00
|
|
|
alsa-lib
|
2020-06-09 04:37:12 +00:00
|
|
|
autoPatchelfHook
|
|
|
|
cups
|
|
|
|
libdrm
|
2020-06-14 07:36:29 +00:00
|
|
|
libuuid
|
2021-04-18 18:12:38 +00:00
|
|
|
libXdamage
|
2020-06-09 04:37:12 +00:00
|
|
|
libX11
|
|
|
|
libXScrnSaver
|
|
|
|
libXtst
|
|
|
|
libxcb
|
2021-06-04 18:23:34 +00:00
|
|
|
libxshmfence
|
2021-05-25 20:22:50 +00:00
|
|
|
mesa
|
2020-06-09 04:37:12 +00:00
|
|
|
nss
|
|
|
|
wrapGAppsHook
|
|
|
|
];
|
2019-06-19 05:39:15 +00:00
|
|
|
|
|
|
|
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
|
2021-06-10 02:57:09 +00:00
|
|
|
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
|
2019-06-19 05:39:15 +00:00
|
|
|
libXcursor libXdamage libXext libXfixes libXi libXrandr libXrender
|
2021-11-21 23:29:40 +00:00
|
|
|
libXtst nspr nss libxcb pango libXScrnSaver
|
2020-10-11 19:14:59 +00:00
|
|
|
libappindicator-gtk3 libdbusmenu
|
2019-06-19 05:39:15 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
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}
|
2019-06-19 05:39:15 +00:00
|
|
|
|
|
|
|
ln -s $out/opt/${binaryName}/${binaryName} $out/bin/
|
2021-06-09 13:47:21 +00:00
|
|
|
# Without || true the install would fail on case-insensitive filesystems
|
|
|
|
ln -s $out/opt/${binaryName}/${binaryName} $out/bin/${lib.strings.toLower binaryName} || true
|
2019-07-18 22:53:14 +00:00
|
|
|
ln -s $out/opt/${binaryName}/discord.png $out/share/pixmaps/${pname}.png
|
2019-06-19 05:39:15 +00:00
|
|
|
|
|
|
|
ln -s "${desktopItem}/share/applications" $out/share/
|
|
|
|
'';
|
|
|
|
|
|
|
|
desktopItem = makeDesktopItem {
|
|
|
|
name = pname;
|
|
|
|
exec = binaryName;
|
|
|
|
icon = pname;
|
|
|
|
inherit desktopName;
|
|
|
|
genericName = meta.description;
|
|
|
|
categories = "Network;InstantMessaging;";
|
2019-12-20 05:50:19 +00:00
|
|
|
mimeType = "x-scheme-handler/discord";
|
2019-06-19 05:39:15 +00:00
|
|
|
};
|
|
|
|
|
2021-07-15 20:14:41 +00:00
|
|
|
passthru.updateScript = writeScript "discord-update-script" ''
|
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#!nix-shell -i bash -p curl gnugrep common-updater-scripts
|
|
|
|
set -eou pipefail;
|
|
|
|
url=$(curl -sI "https://discordapp.com/api/download/${builtins.replaceStrings ["discord-" "discord"] ["" "stable"] pname}?platform=linux&format=tar.gz" | grep -oP 'location: \K\S+')
|
|
|
|
version=''${url##https://dl*.discordapp.net/apps/linux/}
|
|
|
|
version=''${version%%/*.tar.gz}
|
|
|
|
update-source-version ${pname} "$version" --file=./pkgs/applications/networking/instant-messengers/discord/default.nix
|
|
|
|
'';
|
2020-04-12 15:55:36 +00:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2019-06-19 05:39:15 +00:00
|
|
|
description = "All-in-one cross-platform voice and text chat for gamers";
|
|
|
|
homepage = "https://discordapp.com/";
|
|
|
|
downloadPage = "https://discordapp.com/download";
|
|
|
|
license = licenses.unfree;
|
2021-04-27 19:10:25 +00:00
|
|
|
maintainers = with maintainers; [ ldesgoui MP2E ];
|
2019-06-19 05:39:15 +00:00
|
|
|
platforms = [ "x86_64-linux" ];
|
|
|
|
};
|
|
|
|
}
|