2022-04-27 09:35:20 +00:00
|
|
|
#! /usr/bin/env nix-shell
|
2023-10-09 19:29:22 +00:00
|
|
|
#! nix-shell -i bash -p nix nix-prefetch-git gnutar curl jq unzip
|
2022-04-27 09:35:20 +00:00
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
set -euo pipefail
|
2022-04-27 09:35:20 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
cd "$(dirname "$(readlink -f "$0")")"
|
|
|
|
|
|
|
|
log() {
|
|
|
|
tput bold
|
|
|
|
echo "#" "$@"
|
|
|
|
tput sgr0
|
2022-04-27 09:35:20 +00:00
|
|
|
}
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
alias curl='curl -s ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"}'
|
2022-04-27 09:35:20 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
log "Updating compatibility list..."
|
|
|
|
compatListRev="$(curl "https://api.github.com/repos/flathub/org.yuzu_emu.yuzu/commits/master" | jq -r '.sha')"
|
2022-04-27 09:35:20 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
log "Downloading rev: ${compatListRev}"
|
|
|
|
compatListHash="$(nix-prefetch-url "https://raw.githubusercontent.com/flathub/org.yuzu_emu.yuzu/${compatListRev}/compatibility_list.json")"
|
2022-04-27 09:35:20 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
log "Updating mainline..."
|
|
|
|
mainlineVersion="$(curl "https://api.github.com/repos/yuzu-emu/yuzu-mainline/releases?per_page=1" | jq -r '.[0].name' | cut -d" " -f2)"
|
2022-09-09 14:08:57 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
log "Downloading version: ${mainlineVersion}"
|
|
|
|
mainlineHash="$(nix-prefetch-git --fetch-submodules --rev "mainline-0-${mainlineVersion}" "https://github.com/yuzu-emu/yuzu-mainline" | jq -r '.sha256')"
|
2022-04-27 09:35:20 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
log "Updating early access..."
|
|
|
|
eaVersion="$(curl "https://api.github.com/repos/pineappleEA/pineapple-src/releases?per_page=1" | jq -r '.[0].tag_name' | cut -d"-" -f2)"
|
|
|
|
|
|
|
|
log "Downloading dist version: ${eaVersion}"
|
|
|
|
fetched="$(nix-prefetch-url --unpack --print-path "https://github.com/pineappleEA/pineapple-src/releases/download/EA-${eaVersion}/Windows-Yuzu-EA-${eaVersion}.zip")"
|
|
|
|
|
|
|
|
eaDistHash="$(echo "${fetched}" | head -n1)"
|
|
|
|
eaDist="$(echo "${fetched}" | tail -n1)"
|
|
|
|
|
|
|
|
eaDistUnpacked="$(mktemp -d)"
|
|
|
|
trap 'rm -rf "$eaDistUnpacked"' EXIT
|
2022-04-27 09:35:20 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
log "Unpacking dist..."
|
|
|
|
tar xf "$eaDist"/*.tar.xz --directory="$eaDistUnpacked" --strip-components=1
|
|
|
|
|
|
|
|
log "Rehydrating..."
|
|
|
|
eaFullHash="$(nix-prefetch-git --fetch-submodules "$eaDistUnpacked" | jq -r '.sha256')"
|
|
|
|
|
|
|
|
cat >sources.nix <<EOF
|
|
|
|
# Generated by ./update.sh - do not update manually!
|
|
|
|
# Last updated: $(date +%F)
|
|
|
|
{
|
|
|
|
compatList = {
|
|
|
|
rev = "$compatListRev";
|
|
|
|
hash = "sha256:$compatListHash";
|
|
|
|
};
|
|
|
|
|
|
|
|
mainline = {
|
|
|
|
version = "$mainlineVersion";
|
|
|
|
hash = "sha256:$mainlineHash";
|
|
|
|
};
|
|
|
|
|
|
|
|
ea = {
|
|
|
|
version = "$eaVersion";
|
|
|
|
distHash = "sha256:$eaDistHash";
|
|
|
|
fullHash = "sha256:$eaFullHash";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
EOF
|