mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 23:43:30 +00:00
discord: fix updater script (#128633)
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
This commit is contained in:
parent
dadf56e3a6
commit
8e170dc44a
@ -5,6 +5,7 @@
|
||||
, 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
|
||||
@ -71,7 +72,15 @@ in stdenv.mkDerivation rec {
|
||||
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; {
|
||||
description = "All-in-one cross-platform voice and text chat for gamers";
|
||||
|
@ -27,10 +27,10 @@ in {
|
||||
pname = "discord-canary";
|
||||
binaryName = "DiscordCanary";
|
||||
desktopName = "Discord Canary";
|
||||
version = "0.0.125";
|
||||
version = "0.0.126";
|
||||
src = fetchurl {
|
||||
url = "https://dl-canary.discordapp.net/apps/linux/${version}/discord-canary-${version}.tar.gz";
|
||||
sha256 = "0ly5a6l7rvl54mc39xma14jrcrf11q3ndnkkr16by5hy3palmz9g";
|
||||
sha256 = "EraTDRKd6t0c9U68tSRdGkeB1hfqNS4KUewEXwkL8io=";
|
||||
};
|
||||
};
|
||||
}.${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…
Reference in New Issue
Block a user