diff options
author | Devin Singh <drsingh2518@icloud.com> | 2022-01-14 11:30:55 -0600 |
---|---|---|
committer | Devin Singh <drsingh2518@icloud.com> | 2022-01-14 19:19:26 -0600 |
commit | 8a6cde9143085d40886de34037c913323984e7f4 (patch) | |
tree | 00d1bb9a386e99fc9cc88172a1affa6c53fe75cb /pkgs/applications/networking/instant-messengers/discord/linux.nix | |
parent | 2bf5958169ab5ac8871d3f3b9b1d6114de5376f2 (diff) | |
download | nixpkgs-8a6cde9143085d40886de34037c913323984e7f4.tar nixpkgs-8a6cde9143085d40886de34037c913323984e7f4.tar.gz nixpkgs-8a6cde9143085d40886de34037c913323984e7f4.tar.bz2 nixpkgs-8a6cde9143085d40886de34037c913323984e7f4.tar.lz nixpkgs-8a6cde9143085d40886de34037c913323984e7f4.tar.xz nixpkgs-8a6cde9143085d40886de34037c913323984e7f4.tar.zst nixpkgs-8a6cde9143085d40886de34037c913323984e7f4.zip |
discord: add derivations for {x86_64,aarch64}-darwin
Diffstat (limited to 'pkgs/applications/networking/instant-messengers/discord/linux.nix')
-rw-r--r-- | pkgs/applications/networking/instant-messengers/discord/linux.nix | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/pkgs/applications/networking/instant-messengers/discord/linux.nix b/pkgs/applications/networking/instant-messengers/discord/linux.nix new file mode 100644 index 00000000000..866b2889094 --- /dev/null +++ b/pkgs/applications/networking/instant-messengers/discord/linux.nix @@ -0,0 +1,117 @@ +{ pname, version, src, meta, binaryName, desktopName, 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, libXfixes +, libXi, libXrandr, libXrender, libXtst, libxcb, libxshmfence, mesa, nspr, nss +, pango, systemd, libappindicator-gtk3, libdbusmenu, writeScript +, common-updater-scripts }: + +stdenv.mkDerivation rec { + inherit pname version src meta; + + nativeBuildInputs = [ + alsa-lib + autoPatchelfHook + cups + libdrm + libuuid + libXdamage + libX11 + libXScrnSaver + libXtst + libxcb + libxshmfence + mesa + nss + wrapGAppsHook + ]; + + dontWrapGApps = true; + + libPath = lib.makeLibraryPath [ + libcxx + systemd + libpulseaudio + libdrm + mesa + stdenv.cc.cc + alsa-lib + 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 + 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}/" \ + --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 = 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 + ''; +} |