Merge pull request #258525 from Artturin/discordupdatescript

This commit is contained in:
Artturi 2023-10-03 23:21:42 +03:00 committed by GitHub
commit f78ffcc4bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 7 deletions

View file

@ -1,4 +1,4 @@
{ pname, version, src, meta, stdenv, binaryName, desktopName, lib, undmg, makeWrapper
{ pname, version, src, meta, stdenv, binaryName, desktopName, lib, undmg, makeWrapper, writeScript
, branch
, withOpenASAR ? false, openasar
, withVencord ? false, vencord }:
@ -31,4 +31,19 @@ stdenv.mkDerivation {
echo '{"name":"discord","main":"index.js"}' > $out/Applications/${desktopName}.app/Contents/Resources/app.asar/package.json
echo 'require("${vencord}/patcher.js")' > $out/Applications/${desktopName}.app/Contents/Resources/app.asar/index.js
'';
passthru = {
updateScript = writeScript "discord-update-script" ''
#!/usr/bin/env nix-shell
#!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}
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}
'';
};
}

View file

@ -7,9 +7,9 @@ let
development = "0.0.234";
} else {
stable = "0.0.278";
ptb = "0.0.77";
canary = "0.0.312";
development = "0.0.8795";
ptb = "0.0.79";
canary = "0.0.314";
development = "0.0.8797";
};
version = versions.${branch};
srcs = rec {
@ -38,15 +38,15 @@ let
};
ptb = fetchurl {
url = "https://dl-ptb.discordapp.net/apps/osx/${version}/DiscordPTB.dmg";
hash = "sha256-Dn+k51SyHpJ1C1gJx3ZLRzD/cdzhX9qANZU2KEn9lY0=";
hash = "sha256-HI4+ABFQtRBL7a3koCehJgn8WxJW86sCyuZE70n1AHk=";
};
canary = fetchurl {
url = "https://dl-canary.discordapp.net/apps/osx/${version}/DiscordCanary.dmg";
hash = "sha256-iV131kzFcN2+eqUetqZShKqjAQfm64y6bxzAddV7wuw=";
hash = "sha256-SbCEao9Nh3cqCRD7FsHoKMVdy8T1y5tZAAGWHE6bSz0=";
};
development = fetchurl {
url = "https://dl-development.discordapp.net/apps/osx/${version}/DiscordDevelopment.dmg";
hash = "sha256-d/i7LHbJbbUUk/7iU63Xh4RWxs8ZyiCpZSS68JFW2Ps=";
hash = "sha256-ra0El4Y7SqanY6ZBbHE1Y+pqel4OD7nXKKfg/vndULo=";
};
};
aarch64-darwin = x86_64-darwin;