mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-10-19 19:52:28 +03:00
58b812f749
This commit: - Moves the update script into the dir, out of the maintainers dir. This makes it more discoverable in general. It can also be invoked from anywhere to write to default.nix - Swaps it to use the standardized `passthru.updateScript`. This means that eventually bots like `nixpkgs-update` will be able to handle it. - Runs the script to upgrade to the latest versions See https://nixos.org/nixpkgs/manual/#ssec-stdenv-attributes
37 lines
1.1 KiB
Bash
Executable File
37 lines
1.1 KiB
Bash
Executable File
#!/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}"
|