diff --git a/pkgs/applications/networking/instant-messengers/discord/darwin.nix b/pkgs/applications/networking/instant-messengers/discord/darwin.nix index aff995a1cee48..06957341a3bba 100644 --- a/pkgs/applications/networking/instant-messengers/discord/darwin.nix +++ b/pkgs/applications/networking/instant-messengers/discord/darwin.nix @@ -54,11 +54,8 @@ stdenv.mkDerivation { #!nix-shell -i bash -p curl gnugrep common-updater-scripts set -x set -eou pipefail; - url=$(curl -sI "https://discordapp.com/api/download/${ - builtins.replaceStrings [ "discord-" "discord" ] [ "" "stable" ] pname - }?platform=osx&format=dmg" | grep -oP 'location: \K\S+') - version=''${url##https://dl*.discordapp.net/apps/osx/} - version=''${version%%/*.dmg} + url=$(curl -sI -o /dev/null -w '%header{location}' "https://discord.com/api/download/${branch}?platform=osx&format=dmg") + version=$(echo $url | grep -oP '/\K(\d+\.){2}\d+') update-source-version ${lib.optionalString (!stdenv.buildPlatform.isDarwin) "pkgsCross.aarch64-darwin."}${pname} "$version" --file=./pkgs/applications/networking/instant-messengers/discord/default.nix --version-key=${branch} ''; }; diff --git a/pkgs/applications/networking/instant-messengers/discord/linux.nix b/pkgs/applications/networking/instant-messengers/discord/linux.nix index e0375ecf7b89b..3c67d578013b2 100644 --- a/pkgs/applications/networking/instant-messengers/discord/linux.nix +++ b/pkgs/applications/networking/instant-messengers/discord/linux.nix @@ -151,11 +151,8 @@ 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+') - version=''${url##https://dl*.discordapp.net/apps/linux/} - version=''${version%%/*.tar.gz} + url=$(curl -sI -o /dev/null -w '%header{location}' "https://discord.com/api/download/${branch}?platform=linux&format=tar.gz") + version=$(echo $url | grep -oP '/\K(\d+\.){2}\d+') update-source-version ${pname} "$version" --file=./pkgs/applications/networking/instant-messengers/discord/default.nix --version-key=${branch} ''; };