3
0
Fork 0
forked from mirrors/nixpkgs

maintainers/scripts/update-discord: improve

- add comment specifying file is generated
- remove repetition of version number
This commit is contained in:
Tadeo Kondrak 2019-10-11 21:48:57 -06:00 committed by Jon
parent d2d95670a5
commit 70167b64c5
2 changed files with 10 additions and 10 deletions

View file

@ -6,7 +6,7 @@ exec >${1:?usage: $0 <output-file>}
cat <<EOF
{ branch ? "stable", pkgs }:
# Generated by /maintainers/scripts/update-discord
let
inherit (pkgs) callPackage fetchurl;
in {
@ -16,7 +16,7 @@ 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 {"
echo " ${branch:-stable} = callPackage ./base.nix rec {"
echo " pname = \"discord${branch:+-}${branch}\";"
case $branch in
"") suffix="" ;;
@ -27,7 +27,7 @@ for branch in "" ptb canary; do
echo " desktopName = \"Discord${suffix:+ }${suffix}\";"
echo " version = \"${version}\";"
echo " src = fetchurl {"
echo " url = \"${url}\";"
echo " url = \"${url//${version}/\$\{version\}}\";"
echo " sha256 = \"$(nix-prefetch-url "$url")\";"
echo " };"
echo " };"

View file

@ -1,35 +1,35 @@
{ branch ? "stable", pkgs }:
# Generated by /maintainers/scripts/update-discord
let
inherit (pkgs) callPackage fetchurl;
in {
stable = callPackage ./base.nix {
stable = callPackage ./base.nix rec {
pname = "discord";
binaryName = "Discord";
desktopName = "Discord";
version = "0.0.9";
src = fetchurl {
url = "https://dl.discordapp.net/apps/linux/0.0.9/discord-0.0.9.tar.gz";
url = "https://dl.discordapp.net/apps/linux/${version}/discord-${version}.tar.gz";
sha256 = "1i0f8id10rh2fx381hx151qckvvh8hbznfsfav8w0dfbd1bransf";
};
};
ptb = callPackage ./base.nix {
ptb = callPackage ./base.nix rec {
pname = "discord-ptb";
binaryName = "DiscordPTB";
desktopName = "Discord PTB";
version = "0.0.16";
src = fetchurl {
url = "https://dl-ptb.discordapp.net/apps/linux/0.0.16/discord-ptb-0.0.16.tar.gz";
url = "https://dl-ptb.discordapp.net/apps/linux/${version}/discord-ptb-${version}.tar.gz";
sha256 = "1ia94xvzygim9rx1sjnnss518ggw0i20mhp9pby33q70ha35n0aq";
};
};
canary = callPackage ./base.nix {
canary = callPackage ./base.nix rec {
pname = "discord-canary";
binaryName = "DiscordCanary";
desktopName = "Discord Canary";
version = "0.0.97";
src = fetchurl {
url = "https://dl-canary.discordapp.net/apps/linux/0.0.97/discord-canary-0.0.97.tar.gz";
url = "https://dl-canary.discordapp.net/apps/linux/${version}/discord-canary-${version}.tar.gz";
sha256 = "17kwgk2kwrfqgjqmfv055gvlqq144gz7bywwrs6i2x7mimz4345x";
};
};