1 #! /usr/bin/env nix-shell
2 #! nix-shell -i bash -p nix nix-prefetch-git gnutar curl jq unzip
6 cd "$(dirname "$
(readlink
-f "$0")")"
14 alias curl
='curl -s ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"}'
16 log
"Updating compatibility list..."
17 compatListRev
="$(curl "https
://api.github.com
/repos
/flathub
/org.yuzu_emu.yuzu
/commits
/master
" | jq -r '.sha')"
19 log
"Downloading rev: ${compatListRev}"
20 compatListHash
="$(nix-prefetch-url "https
://raw.githubusercontent.com
/flathub
/org.yuzu_emu.yuzu
/${compatListRev}/compatibility_list.json
")"
22 log
"Updating mainline..."
23 mainlineVersion
="$(curl "https
://api.github.com
/repos
/yuzu-emu
/yuzu-mainline
/releases?per_page
=1" | jq -r '.[0].name' | cut -d" " -f2)"
25 log
"Downloading version: ${mainlineVersion}"
26 mainlineHash
="$(nix-prefetch-git --fetch-submodules --rev "mainline-0-
${mainlineVersion}" "https
://github.com
/yuzu-emu
/yuzu-mainline
" | jq -r '.sha256')"
28 log
"Updating early access..."
29 eaVersion
="$(curl "https
://api.github.com
/repos
/pineappleEA
/pineapple-src
/releases?per_page
=1" | jq -r '.[0].tag_name' | cut -d"-" -f2)"
31 log
"Downloading dist version: ${eaVersion}"
32 fetched
="$(nix-prefetch-url --unpack --print-path "https
://github.com
/pineappleEA
/pineapple-src
/releases
/download
/EA-
${eaVersion}/Windows-Yuzu-EA-
${eaVersion}.
zip")"
34 eaDistHash
="$(echo "${fetched}" | head -n1)"
35 eaDist
="$(echo "${fetched}" | tail -n1)"
37 eaDistUnpacked
="$(mktemp -d)"
38 trap 'rm -rf "$eaDistUnpacked"' EXIT
40 log
"Unpacking dist..."
41 tar xf
"$eaDist"/*.
tar.xz
--directory="$eaDistUnpacked" --strip-components=1
44 eaFullHash
="$(nix-prefetch-git --fetch-submodules "$eaDistUnpacked" | jq -r '.sha256')"
46 cat >sources.nix
<<EOF
47 # Generated by ./update.sh - do not update manually!
48 # Last updated: $(date +%F)
51 rev = "$compatListRev";
52 hash = "sha256:$compatListHash";
56 version = "$mainlineVersion";
57 hash = "sha256:$mainlineHash";
61 version = "$eaVersion";
62 distHash = "sha256:$eaDistHash";
63 fullHash = "sha256:$eaFullHash";