about summary refs log tree commit diff
path: root/pkgs/applications/networking/instant-messengers/discord/base.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/networking/instant-messengers/discord/base.nix')
-rw-r--r--pkgs/applications/networking/instant-messengers/discord/base.nix61
1 files changed, 61 insertions, 0 deletions
diff --git a/pkgs/applications/networking/instant-messengers/discord/base.nix b/pkgs/applications/networking/instant-messengers/discord/base.nix
new file mode 100644
index 000000000000..63149d3d54b9
--- /dev/null
+++ b/pkgs/applications/networking/instant-messengers/discord/base.nix
@@ -0,0 +1,61 @@
+{ pname, version, src, binaryName, desktopName
+, stdenv, fetchurl, makeDesktopItem, wrapGAppsHook
+, alsaLib, atk, at-spi2-atk, at-spi2-core, cairo, cups, dbus, expat, fontconfig, freetype
+, gdk_pixbuf, glib, gtk3, libnotify, libX11, libXcomposite, libXcursor, libXdamage, libuuid
+, libXext, libXfixes, libXi, libXrandr, libXrender, libXtst, nspr, nss, libxcb
+, pango, systemd, libXScrnSaver, libcxx, libpulseaudio }:
+
+let
+  inherit binaryName;
+in stdenv.mkDerivation rec {
+  inherit pname version src;
+
+  nativeBuildInputs = [ wrapGAppsHook ];
+
+  dontWrapGApps = true;
+
+  libPath = stdenv.lib.makeLibraryPath [
+    libcxx systemd libpulseaudio
+    stdenv.cc.cc alsaLib atk at-spi2-atk at-spi2-core cairo cups dbus expat fontconfig freetype
+    gdk_pixbuf glib gtk3 libnotify libX11 libXcomposite libuuid
+    libXcursor libXdamage libXext libXfixes libXi libXrandr libXrender
+    libXtst nspr nss libxcb pango systemd libXScrnSaver
+   ];
+
+  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}/" \
+        --prefix LD_LIBRARY_PATH : ${libPath}
+
+    ln -s $out/opt/${binaryName}/${binaryName} $out/bin/
+    ln -s $out/opt/${binaryName}/discord.png $out/share/pixmaps/${binaryName}.png
+
+    ln -s "${desktopItem}/share/applications" $out/share/
+  '';
+
+  desktopItem = makeDesktopItem {
+    name = pname;
+    exec = binaryName;
+    icon = pname;
+    inherit desktopName;
+    genericName = meta.description;
+    categories = "Network;InstantMessaging;";
+  };
+
+  meta = with stdenv.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 tadeokondrak ];
+    platforms = [ "x86_64-linux" ];
+  };
+}