You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
118 lines
3.1 KiB
118 lines
3.1 KiB
2 years ago
|
{ 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 }:
|
||
5 years ago
|
|
||
2 years ago
|
stdenv.mkDerivation rec {
|
||
|
inherit pname version src meta;
|
||
5 years ago
|
|
||
4 years ago
|
nativeBuildInputs = [
|
||
3 years ago
|
alsa-lib
|
||
4 years ago
|
autoPatchelfHook
|
||
|
cups
|
||
|
libdrm
|
||
4 years ago
|
libuuid
|
||
3 years ago
|
libXdamage
|
||
4 years ago
|
libX11
|
||
|
libXScrnSaver
|
||
|
libXtst
|
||
|
libxcb
|
||
3 years ago
|
libxshmfence
|
||
3 years ago
|
mesa
|
||
4 years ago
|
nss
|
||
|
wrapGAppsHook
|
||
|
];
|
||
5 years ago
|
|
||
|
dontWrapGApps = true;
|
||
|
|
||
3 years ago
|
libPath = lib.makeLibraryPath [
|
||
2 years ago
|
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
|
||
|
];
|
||
5 years ago
|
|
||
|
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}/" \
|
||
3 years ago
|
--prefix LD_LIBRARY_PATH : ${libPath}:$out/opt/${binaryName}
|
||
5 years ago
|
|
||
|
ln -s $out/opt/${binaryName}/${binaryName} $out/bin/
|
||
3 years ago
|
# Without || true the install would fail on case-insensitive filesystems
|
||
2 years ago
|
ln -s $out/opt/${binaryName}/${binaryName} $out/bin/${
|
||
|
lib.strings.toLower binaryName
|
||
|
} || true
|
||
5 years ago
|
ln -s $out/opt/${binaryName}/discord.png $out/share/pixmaps/${pname}.png
|
||
5 years ago
|
|
||
|
ln -s "${desktopItem}/share/applications" $out/share/
|
||
|
'';
|
||
|
|
||
|
desktopItem = makeDesktopItem {
|
||
|
name = pname;
|
||
|
exec = binaryName;
|
||
|
icon = pname;
|
||
|
inherit desktopName;
|
||
|
genericName = meta.description;
|
||
|
categories = "Network;InstantMessaging;";
|
||
5 years ago
|
mimeType = "x-scheme-handler/discord";
|
||
5 years ago
|
};
|
||
|
|
||
3 years ago
|
passthru.updateScript = writeScript "discord-update-script" ''
|
||
|
#!/usr/bin/env nix-shell
|
||
|
#!nix-shell -i bash -p curl gnugrep common-updater-scripts
|
||
|
set -eou pipefail;
|
||
2 years ago
|
url=$(curl -sI "https://discordapp.com/api/download/${
|
||
|
builtins.replaceStrings [ "discord-" "discord" ] [ "" "stable" ] pname
|
||
|
}?platform=linux&format=tar.gz" | grep -oP 'location: \K\S+')
|
||
3 years ago
|
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
|
||
|
'';
|
||
5 years ago
|
}
|