···4545stdenv.mkDerivation rec {
4646 inherit pname version src;
47474848- # Replace icons licensed under CC BY-ND 3.0 with free ones to allow
4949- # for binary redistribution: https://github.com/yuzu-emu/yuzu/pull/8104
5050- # The patch hosted on GitHub has the binary information in git format, which
5151- # can’t be applied with patch(1), so it has been regenerated with
5252- # "git format-patch --text --full-index --binary".
5353- # Because pineapple strips all files beginning with a dot, the patch needs to
5454- # be edited manually afterwards to remove all changes to those.
5555- patches = [ ./yuzu-free-icons.patch ];
5656-5748 nativeBuildInputs = [
5849 cmake
5950 doxygen
···111102 "-DENABLE_COMPATIBILITY_LIST_DOWNLOAD=OFF" # We provide this deterministically
112103 ];
113104105105+ qtWrapperArgs = [
106106+ # Fixes vulkan detection
107107+ "--prefix LD_LIBRARY_PATH : ${vulkan-loader}/lib"
108108+ # Without yuzu doesnt start on wayland. See https://github.com/yuzu-emu/yuzu/issues/6088
109109+ "--set QT_QPA_PLATFORM xcb"
110110+ ];
111111+114112 preConfigure = ''
115113 # This prevents a check for submodule directories.
116114 rm -f .gitmodules
···125123 # This must be done after cmake finishes as it overwrites the file
126124 postConfigure = ''
127125 ln -sf ${compat-list} ./dist/compatibility_list/compatibility_list.json
128128- '';
129129-130130- # Fix vulkan detection
131131- postFixup = ''
132132- for bin in $out/bin/yuzu $out/bin/yuzu-cmd; do
133133- wrapProgram $bin --prefix LD_LIBRARY_PATH : ${vulkan-loader}/lib
134134- done
135126 '';
136127137128 passthru.updateScript = runCommandLocal "yuzu-${branch}-updateScript" {
···154145 platforms = [ "x86_64-linux" ];
155146 license = with licenses; [
156147 gpl3Plus
157157- # Icons. Note that this would be cc0 and cc-by-nd-30 without the "yuzu-free-icons" patch
148148+ # Icons
158149 asl20 mit cc0
159150 ];
160151 maintainers = with maintainers; [
+78-57
pkgs/applications/emulators/yuzu/update.sh
···11#! /usr/bin/env nix-shell
22-#! nix-shell -i bash -p nix nix-prefetch-git coreutils curl jq gnused
22+#! nix-shell -I nixpkgs=./. -i bash -p nix nix-prefetch-git coreutils curl jq gnused
3344-set -e
44+set -euo pipefail
5566# Will be replaced with the actual branch when running this from passthru.updateScript
77BRANCH="@branch@"
88+DEFAULT_NIX="$(dirname "${BASH_SOURCE[@]}")/default.nix"
8999-if [[ ! "$(basename $PWD)" = "yuzu" ]]; then
1010- echo "error: Script must be ran from yuzu's directory!"
1010+if [[ "$(basename "$PWD")" = "yuzu" ]]; then
1111+ echo "error: Script must be ran from nixpkgs's root directory for compatibility with the maintainer script"
1112 exit 1
1213fi
13141414-getLocalVersion() {
1515- pushd ../../../.. >/dev/null
1616- nix eval --raw -f default.nix "$1".version
1717- popd >/dev/null
1818-}
1919-2020-getLocalHash() {
2121- pushd ../../../.. >/dev/null
2222- nix eval --raw -f default.nix "$1".src.drvAttrs.outputHash
2323- popd >/dev/null
2424-}
2525-2626-updateMainline() {
2727- OLD_MAINLINE_VERSION="$(getLocalVersion "yuzu-mainline")"
2828- OLD_MAINLINE_HASH="$(getLocalHash "yuzu-mainline")"
2929-3030- NEW_MAINLINE_VERSION="$(curl -s ${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} \
3131- "https://api.github.com/repos/yuzu-emu/yuzu-mainline/releases?per_page=1" | jq -r '.[0].name' | cut -d" " -f2)"
1515+updateBranch() {
1616+ local branch attribute oldVersion oldHash newVersion newHash
1717+ branch="$1"
1818+ attribute="yuzu-$branch"
1919+ [[ "$branch" = "early-access" ]] && attribute="yuzu-ea" # Attribute path doesnt match the branch name
2020+ oldVersion="$(nix eval --raw -f "./default.nix" "$attribute".version)"
2121+ oldHash="$(nix eval --raw -f "./default.nix" "$attribute".src.drvAttrs.outputHash)"
32223333- if [[ "${OLD_MAINLINE_VERSION}" = "${NEW_MAINLINE_VERSION}" ]]; then
3434- echo "yuzu-mainline is already up to date!"
2323+ if [[ "$branch" = "mainline" ]]; then
2424+ newVersion="$(curl -s ${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} "https://api.github.com/repos/yuzu-emu/yuzu-mainline/releases?per_page=1" \
2525+ | jq -r '.[0].name' | cut -d" " -f2)"
2626+ elif [[ "$branch" = "early-access" ]]; then
2727+ newVersion="$(curl -s ${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} "https://api.github.com/repos/pineappleEA/pineapple-src/releases?per_page=2" \
2828+ | jq -r '.[].tag_name' | grep '^EA-[0-9]*' | head -n1 | cut -d"-" -f2 | cut -d" " -f1)"
2929+ fi
35303636- [ "$KEEP_GOING" ] && return || exit
3131+ if [[ "${oldVersion}" = "${newVersion}" ]]; then
3232+ echo "$attribute is already up to date."
3333+ return
3734 else
3838- echo "yuzu-mainline: ${OLD_MAINLINE_VERSION} -> ${NEW_MAINLINE_VERSION}"
3535+ echo "$attribute: ${oldVersion} -> ${newVersion}"
3936 fi
40374141- echo " Fetching source code..."
3838+ echo " fetching source code to generate hash..."
3939+ if [[ "$branch" = "mainline" ]]; then
4040+ newHash="$(nix-prefetch-git --quiet --fetch-submodules --rev "mainline-0-${newVersion}" "https://github.com/yuzu-emu/yuzu-mainline" | jq -r '.sha256')"
4141+ elif [[ "$branch" = "early-access" ]]; then
4242+ newHash="$(nix-prefetch-git --quiet --fetch-submodules --rev "EA-${newVersion}" "https://github.com/pineappleEA/pineapple-src" | jq -r '.sha256')"
4343+ fi
4444+ newHash="$(nix hash to-sri --type sha256 "${newHash}")"
42454343- NEW_MAINLINE_HASH="$(nix-prefetch-git --quiet --fetch-submodules --rev "mainline-0-${NEW_MAINLINE_VERSION}" "https://github.com/yuzu-emu/yuzu-mainline" | jq -r '.sha256')"
4646+ sed -i "s,${oldVersion},${newVersion}," "$DEFAULT_NIX"
4747+ sed -i "s,${oldHash},${newHash},g" "$DEFAULT_NIX"
4848+ echo " succesfully updated $attribute. new hash: $newHash"
4949+}
44504545- echo " Succesfully fetched. hash: ${NEW_MAINLINE_HASH}"
5151+updateCompatibilityList() {
5252+ local latestRevision oldUrl newUrl oldHash newHash oldDate newDate
5353+ latestRevision="$(curl -s ${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} "https://api.github.com/repos/flathub/org.yuzu_emu.yuzu/commits/master" | jq -r '.sha')"
46544747- sed -i "s/${OLD_MAINLINE_VERSION}/${NEW_MAINLINE_VERSION}/" ./default.nix
4848- sed -i "s/${OLD_MAINLINE_HASH}/${NEW_MAINLINE_HASH}/" ./default.nix
4949-}
5555+ oldUrl="$(sed -n '/yuzu-compat-list/,/url/p' "$DEFAULT_NIX" | tail -n1 | cut -d'"' -f2)"
5656+ newUrl="https://raw.githubusercontent.com/flathub/org.yuzu_emu.yuzu/${latestRevision}/compatibility_list.json"
50575151-updateEarlyAccess() {
5252- OLD_EA_VERSION="$(getLocalVersion "yuzu-ea")"
5353- OLD_EA_HASH="$(getLocalHash "yuzu-ea")"
5858+ oldDate="$(sed -n '/last updated.*/p' "$DEFAULT_NIX" | rev | cut -d' ' -f1 | rev)"
5959+ newDate="$(curl -s ${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} "https://api.github.com/repos/flathub/org.yuzu_emu.yuzu/commits/${latestRevision}" \
6060+ | jq -r '.commit.committer.date' | cut -d'T' -f1)"
54615555- NEW_EA_VERSION="$(curl -s ${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} \
5656- "https://api.github.com/repos/pineappleEA/pineapple-src/releases?per_page=2" | jq -r '.[].tag_name' | grep '^EA-[0-9]*' | head -n1 | cut -d"-" -f2 | cut -d" " -f1)"
5757-5858- if [[ "${OLD_EA_VERSION}" = "${NEW_EA_VERSION}" ]]; then
5959- echo "yuzu-ea is already up to date!"
6262+ oldHash="$(sed -n '/yuzu-compat-list/,/sha256/p' "$DEFAULT_NIX" | tail -n1 | cut -d'"' -f2)"
6363+ newHash="$(nix hash to-sri --type sha256 "$(nix-prefetch-url --quiet "$newUrl")")"
60646161- [ "$KEEP_GOING" ] && return || exit
6565+ if [[ "$oldHash" = "$newHash" ]]; then
6666+ echo "compatibility_list is already up to date."
6767+ return
6268 else
6363- echo "yuzu-ea: ${OLD_EA_VERSION} -> ${NEW_EA_VERSION}"
6969+ echo "compatibility_list: $oldDate -> $newDate"
6470 fi
65716666- echo " Fetching source code..."
7272+ sed -i "s,${oldUrl},${newUrl},g" "$DEFAULT_NIX"
7373+ sed -i "s,${oldHash},${newHash},g" "$DEFAULT_NIX"
7474+ sed -i "s,${oldDate},${newDate},g" "$DEFAULT_NIX"
7575+ echo " succesfully updated compatibility_list. new hash: $newHash"
7676+}
67776868- NEW_EA_HASH="$(nix-prefetch-git --quiet --fetch-submodules --rev "EA-${NEW_EA_VERSION}" "https://github.com/pineappleEA/pineapple-src" | jq -r '.sha256')"
7878+if [[ "$BRANCH" = "mainline" ]] || [[ "$BRANCH" = "early-access" ]]; then
7979+ updateBranch "$BRANCH"
8080+ updateCompatibilityList
8181+else # Script is not ran from passthru.updateScript
8282+ if (( $# == 0 )); then
8383+ updateBranch "mainline"
8484+ updateBranch "early-access"
8585+ fi
69867070- echo " Succesfully fetched. hash: ${NEW_EA_HASH}"
7171-7272- sed -i "s/${OLD_EA_VERSION}/${NEW_EA_VERSION}/" ./default.nix
7373- sed -i "s/${OLD_EA_HASH}/${NEW_EA_HASH}/" ./default.nix
7474-}
8787+ while (( "$#" > 0 )); do
8888+ case "$1" in
8989+ mainline|yuzu-mainline)
9090+ updateBranch "mainline"
9191+ ;;
9292+ early-access|yuzu-early-access|ea|yuzu-ea)
9393+ updateBranch "early-access"
9494+ ;;
9595+ *)
9696+ echo "error: invalid branch: $1."
9797+ echo "usage: $(basename "$0") [mainline|early-access]"
9898+ exit 1
9999+ ;;
100100+ esac
101101+ shift
102102+ done
751037676-if [[ "$BRANCH" = "mainline" ]]; then
7777- updateMainline
7878-elif [[ "$BRANCH" = "early-access" ]]; then
7979- updateEarlyAccess
8080-else
8181- KEEP_GOING=1
8282- updateMainline
8383- updateEarlyAccess
104104+ updateCompatibilityList
84105fi
···15491549 youtubeDL = throw "'youtubeDL' has been renamed to/replaced by 'youtube-dl'"; # Converted to throw 2022-02-22
15501550 ytop = throw "ytop has been abandoned by upstream. Consider switching to bottom instead";
15511551 yubikey-neo-manager = throw "yubikey-neo-manager has been removed because it was broken. Use yubikey-manager-qt instead"; # Added 2021-03-08
15521552+ yuzu-ea = yuzu-early-access; # Added 2022-08-18
15521553 yuzu = yuzu-mainline; # Added 2021-01-25
1553155415541555 ### Z ###