Merge pull request #155020 from devins2518/discord_mac
discord{,-ptb,-canary}: add derivations for {x86_64,aarch64}-darwin
This commit is contained in:
commit
f542129a99
4 changed files with 155 additions and 63 deletions
|
@ -0,0 +1,14 @@
|
|||
{ pname, version, src, meta, stdenv, binaryName, desktopName, undmg }:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
inherit pname version src meta;
|
||||
|
||||
nativeBuildInputs = [ undmg ];
|
||||
|
||||
sourceRoot = ".";
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/Applications
|
||||
cp -r "${desktopName}.app" $out/Applications
|
||||
'';
|
||||
}
|
|
@ -1,35 +1,89 @@
|
|||
{ branch ? "stable", pkgs }:
|
||||
{ branch ? "stable", pkgs, lib, stdenv }:
|
||||
let
|
||||
inherit (pkgs) callPackage fetchurl;
|
||||
in {
|
||||
stable = callPackage ./base.nix rec {
|
||||
pname = "discord";
|
||||
binaryName = "Discord";
|
||||
desktopName = "Discord";
|
||||
version = "0.0.16";
|
||||
src = fetchurl {
|
||||
url = "https://dl.discordapp.net/apps/linux/${version}/discord-${version}.tar.gz";
|
||||
sha256 = "UTVKjs/i7C/m8141bXBsakQRFd/c//EmqqhKhkr1OOk=";
|
||||
versions = if stdenv.isLinux then {
|
||||
stable = "0.0.16";
|
||||
ptb = "0.0.27";
|
||||
canary = "0.0.132";
|
||||
} else {
|
||||
stable = "0.0.264";
|
||||
ptb = "0.0.58";
|
||||
canary = "0.0.280";
|
||||
};
|
||||
version = versions.${branch};
|
||||
srcs = {
|
||||
x86_64-linux = {
|
||||
stable = fetchurl {
|
||||
url =
|
||||
"https://dl.discordapp.net/apps/linux/${version}/discord-${version}.tar.gz";
|
||||
sha256 = "UTVKjs/i7C/m8141bXBsakQRFd/c//EmqqhKhkr1OOk=";
|
||||
};
|
||||
ptb = fetchurl {
|
||||
url =
|
||||
"https://dl-ptb.discordapp.net/apps/linux/${version}/discord-ptb-${version}.tar.gz";
|
||||
sha256 = "0yphs65wpyr0ap6y24b0nbhq7sm02dg5c1yiym1fxjbynm1mdvqb";
|
||||
};
|
||||
canary = fetchurl {
|
||||
url =
|
||||
"https://dl-canary.discordapp.net/apps/linux/${version}/discord-canary-${version}.tar.gz";
|
||||
sha256 = "1jjbd9qllgcdpnfxg5alxpwl050vzg13rh17n638wha0vv4mjhyv";
|
||||
};
|
||||
};
|
||||
x86_64-darwin = {
|
||||
stable = fetchurl {
|
||||
url = "https://dl.discordapp.net/apps/osx/${version}/Discord.dmg";
|
||||
sha256 = "1jvlxmbfqhslsr16prsgbki77kq7i3ipbkbn67pnwlnis40y9s7p";
|
||||
};
|
||||
ptb = fetchurl {
|
||||
url =
|
||||
"https://dl-ptb.discordapp.net/apps/osx/${version}/DiscordPTB.dmg";
|
||||
sha256 = "sha256-GwYUoPBbx9lSaRP1JwzI0UE9gEU+rV4a9BNPVSxHki0=";
|
||||
};
|
||||
canary = fetchurl {
|
||||
url =
|
||||
"https://dl-canary.discordapp.net/apps/osx/${version}/DiscordCanary.dmg";
|
||||
sha256 = "0ccchsywry68vv81pqzzxmh1r19lnvxr429iwvgfr9y82lyjvz06";
|
||||
};
|
||||
};
|
||||
# Only PTB bundles a MachO Universal binary with ARM support.
|
||||
aarch64-darwin = {
|
||||
ptb = fetchurl {
|
||||
url =
|
||||
"https://dl-ptb.discordapp.net/apps/osx/${version}/DiscordPTB.dmg";
|
||||
sha256 = "sha256-GwYUoPBbx9lSaRP1JwzI0UE9gEU+rV4a9BNPVSxHki0=";
|
||||
};
|
||||
};
|
||||
};
|
||||
ptb = callPackage ./base.nix rec {
|
||||
pname = "discord-ptb";
|
||||
binaryName = "DiscordPTB";
|
||||
desktopName = "Discord PTB";
|
||||
version = "0.0.27";
|
||||
src = fetchurl {
|
||||
url = "https://dl-ptb.discordapp.net/apps/linux/${version}/discord-ptb-${version}.tar.gz";
|
||||
sha256 = "0yphs65wpyr0ap6y24b0nbhq7sm02dg5c1yiym1fxjbynm1mdvqb";
|
||||
src = srcs.${stdenv.hostPlatform.system}.${branch};
|
||||
|
||||
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 devins2518 ];
|
||||
platforms = [ "x86_64-linux" "x86_64-darwin" ]
|
||||
++ lib.optionals (branch == "ptb") [ "aarch64-darwin" ];
|
||||
};
|
||||
package = if stdenv.isLinux then ./linux.nix else ./darwin.nix;
|
||||
packages = {
|
||||
stable = callPackage package rec {
|
||||
inherit src version meta;
|
||||
pname = "discord";
|
||||
binaryName = "Discord";
|
||||
desktopName = "Discord";
|
||||
};
|
||||
ptb = callPackage package rec {
|
||||
inherit src version meta;
|
||||
pname = "discord-ptb";
|
||||
binaryName = "DiscordPTB";
|
||||
desktopName = "Discord PTB";
|
||||
};
|
||||
canary = callPackage package rec {
|
||||
inherit src version meta;
|
||||
pname = "discord-canary";
|
||||
binaryName = "DiscordCanary";
|
||||
desktopName = "Discord Canary";
|
||||
};
|
||||
};
|
||||
canary = callPackage ./base.nix rec {
|
||||
pname = "discord-canary";
|
||||
binaryName = "DiscordCanary";
|
||||
desktopName = "Discord Canary";
|
||||
version = "0.0.132";
|
||||
src = fetchurl {
|
||||
url = "https://dl-canary.discordapp.net/apps/linux/${version}/discord-canary-${version}.tar.gz";
|
||||
sha256 = "1jjbd9qllgcdpnfxg5alxpwl050vzg13rh17n638wha0vv4mjhyv";
|
||||
};
|
||||
};
|
||||
}.${branch}
|
||||
in packages.${branch}
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
{ pname, version, src, 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
|
||||
}:
|
||||
{ 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 }:
|
||||
|
||||
let
|
||||
inherit binaryName;
|
||||
in stdenv.mkDerivation rec {
|
||||
inherit pname version src;
|
||||
stdenv.mkDerivation rec {
|
||||
inherit pname version src meta;
|
||||
|
||||
nativeBuildInputs = [
|
||||
alsa-lib
|
||||
|
@ -33,13 +30,45 @@ in stdenv.mkDerivation rec {
|
|||
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
|
||||
];
|
||||
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}
|
||||
|
@ -56,7 +85,9 @@ in stdenv.mkDerivation rec {
|
|||
|
||||
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}/${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/
|
||||
|
@ -76,18 +107,11 @@ in stdenv.mkDerivation rec {
|
|||
#!/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+')
|
||||
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
|
||||
'';
|
||||
|
||||
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" ];
|
||||
};
|
||||
}
|
|
@ -34025,17 +34025,17 @@ with pkgs;
|
|||
|
||||
discord = import ../applications/networking/instant-messengers/discord {
|
||||
branch = "stable";
|
||||
inherit pkgs;
|
||||
inherit pkgs lib stdenv;
|
||||
};
|
||||
|
||||
discord-ptb = import ../applications/networking/instant-messengers/discord {
|
||||
branch = "ptb";
|
||||
inherit pkgs;
|
||||
inherit pkgs lib stdenv;
|
||||
};
|
||||
|
||||
discord-canary = import ../applications/networking/instant-messengers/discord {
|
||||
branch = "canary";
|
||||
inherit pkgs;
|
||||
inherit pkgs lib stdenv;
|
||||
};
|
||||
|
||||
golden-cheetah = libsForQt514.callPackage ../applications/misc/golden-cheetah {};
|
||||
|
|
Loading…
Reference in a new issue