Merge pull request #130303 from NixOS/backport-128633-to-release-21.05
[Backport release-21.05] discord: fix updater script
This commit is contained in:
commit
807a22965a
@ -5,6 +5,7 @@
|
|||||||
, libX11, libXScrnSaver, libXcomposite, libXcursor, libXdamage, libXext
|
, libX11, libXScrnSaver, libXcomposite, libXcursor, libXdamage, libXext
|
||||||
, libXfixes, libXi, libXrandr, libXrender, libXtst, libxcb, libxshmfence
|
, libXfixes, libXi, libXrandr, libXrender, libXtst, libxcb, libxshmfence
|
||||||
, mesa, nspr, nss, pango, systemd, libappindicator-gtk3, libdbusmenu
|
, mesa, nspr, nss, pango, systemd, libappindicator-gtk3, libdbusmenu
|
||||||
|
, writeScript, common-updater-scripts
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
@ -71,7 +72,15 @@ in stdenv.mkDerivation rec {
|
|||||||
mimeType = "x-scheme-handler/discord";
|
mimeType = "x-scheme-handler/discord";
|
||||||
};
|
};
|
||||||
|
|
||||||
passthru.updateScript = ./update-discord.sh;
|
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
|
||||||
|
'';
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "All-in-one cross-platform voice and text chat for gamers";
|
description = "All-in-one cross-platform voice and text chat for gamers";
|
||||||
|
@ -27,10 +27,10 @@ in {
|
|||||||
pname = "discord-canary";
|
pname = "discord-canary";
|
||||||
binaryName = "DiscordCanary";
|
binaryName = "DiscordCanary";
|
||||||
desktopName = "Discord Canary";
|
desktopName = "Discord Canary";
|
||||||
version = "0.0.125";
|
version = "0.0.126";
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "https://dl-canary.discordapp.net/apps/linux/${version}/discord-canary-${version}.tar.gz";
|
url = "https://dl-canary.discordapp.net/apps/linux/${version}/discord-canary-${version}.tar.gz";
|
||||||
sha256 = "0ly5a6l7rvl54mc39xma14jrcrf11q3ndnkkr16by5hy3palmz9g";
|
sha256 = "EraTDRKd6t0c9U68tSRdGkeB1hfqNS4KUewEXwkL8io=";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}.${branch}
|
}.${branch}
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# script to generate ./default.nix
|
|
||||||
|
|
||||||
set -e
|
|
||||||
exec >"${BASH_SOURCE%/*}/default.nix"
|
|
||||||
|
|
||||||
cat <<EOF
|
|
||||||
{ branch ? "stable", pkgs }:
|
|
||||||
# Generated by ./update-discord.sh
|
|
||||||
let
|
|
||||||
inherit (pkgs) callPackage fetchurl;
|
|
||||||
in {
|
|
||||||
EOF
|
|
||||||
|
|
||||||
for branch in "" ptb canary; do
|
|
||||||
url=$(curl -sI "https://discordapp.com/api/download${branch:+/}${branch}?platform=linux&format=tar.gz" | grep -oP 'location: \K\S+')
|
|
||||||
version=${url##https://dl*.discordapp.net/apps/linux/}
|
|
||||||
version=${version%%/*.tar.gz}
|
|
||||||
echo " ${branch:-stable} = callPackage ./base.nix rec {"
|
|
||||||
echo " pname = \"discord${branch:+-}${branch}\";"
|
|
||||||
case $branch in
|
|
||||||
"") suffix="" ;;
|
|
||||||
ptb) suffix="PTB" ;;
|
|
||||||
canary) suffix="Canary" ;;
|
|
||||||
esac
|
|
||||||
echo " binaryName = \"Discord${suffix}\";"
|
|
||||||
echo " desktopName = \"Discord${suffix:+ }${suffix}\";"
|
|
||||||
echo " version = \"${version}\";"
|
|
||||||
echo " src = fetchurl {"
|
|
||||||
echo " url = \"${url//${version}/\$\{version\}}\";"
|
|
||||||
echo " sha256 = \"$(nix-prefetch-url "$url")\";"
|
|
||||||
echo " };"
|
|
||||||
echo " };"
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "}.\${branch}"
|
|
Loading…
x
Reference in New Issue
Block a user