Merge pull request #228872 from K900/weird-fruit

yuzu: update, switch to qt6, clean up, etc

authored by Linus Heckemann and committed by GitHub cf4f8bfe 4321fad6

+170 -155
+51 -28
pkgs/applications/emulators/yuzu/default.nix
··· 1 1 { branch ? "mainline" 2 - , libsForQt5 2 + , qt6Packages 3 3 , fetchFromGitHub 4 + , fetchgit 4 5 , fetchurl 6 + , fetchzip 7 + , runCommand 8 + , gnutar 5 9 }: 6 10 7 11 let 8 - # Mirror of https://api.yuzu-emu.org/gamedb, last updated 2022-08-13 9 - # Please make sure to update this when updating yuzu! 12 + sources = import ./sources.nix; 13 + 10 14 compat-list = fetchurl { 11 15 name = "yuzu-compat-list"; 12 - url = "https://raw.githubusercontent.com/flathub/org.yuzu_emu.yuzu/d83401d2ee3fd5e1922e31baed1f3bdb1c0f036c/compatibility_list.json"; 13 - sha256 = "sha256-anOmO7NscHDsQxT03+YbJEyBkXjhcSVGgKpDwt//GHw="; 16 + url = "https://raw.githubusercontent.com/flathub/org.yuzu_emu.yuzu/${sources.compatList.rev}/compatibility_list.json"; 17 + hash = sources.compatList.hash; 14 18 }; 15 - in { 16 - mainline = libsForQt5.callPackage ./generic.nix rec { 17 - pname = "yuzu-mainline"; 18 - version = "1245"; 19 19 20 - src = fetchFromGitHub { 21 - owner = "yuzu-emu"; 22 - repo = "yuzu-mainline"; 23 - rev = "mainline-0-${version}"; 24 - sha256 = "sha256-lWXlY1KQC067MvCRUFhmr0c7KDrHDuwJOhIWMKw1f+A="; 25 - fetchSubmodules = true; 26 - }; 20 + mainlineSrc = fetchFromGitHub { 21 + owner = "yuzu-emu"; 22 + repo = "yuzu-mainline"; 23 + rev = "mainline-0-${sources.mainline.version}"; 24 + hash = sources.mainline.hash; 25 + fetchSubmodules = true; 26 + }; 27 27 28 - inherit branch compat-list; 28 + # The mirror repo for early access builds is missing submodule info, 29 + # but the Windows distributions include a source tarball, which in turn 30 + # includes the full git metadata. So, grab that and rehydrate it. 31 + # This has the unfortunate side effect of requiring two FODs, one 32 + # for the Windows download and one for the full repo with submodules. 33 + eaZip = fetchzip { 34 + name = "yuzu-ea-windows-dist"; 35 + url = "https://github.com/pineappleEA/pineapple-src/releases/download/EA-${sources.ea.version}/Windows-Yuzu-EA-${sources.ea.version}.zip"; 36 + hash = sources.ea.distHash; 29 37 }; 30 38 31 - early-access = libsForQt5.callPackage ./generic.nix rec { 32 - pname = "yuzu-ea"; 33 - version = "2945"; 39 + eaGitSrc = runCommand "yuzu-ea-dist-unpacked" { 40 + src = eaZip; 41 + nativeBuildInputs = [ gnutar ]; 42 + } 43 + '' 44 + mkdir $out 45 + tar xf $src/*.tar.xz --directory=$out --strip-components=1 46 + ''; 34 47 35 - src = fetchFromGitHub { 36 - owner = "pineappleEA"; 37 - repo = "pineapple-src"; 38 - rev = "EA-${version}"; 39 - sha256 = "sha256-/051EtQxhB5oKH/JxZZ2AjnxOBcRxCBIwd4Qr8lq7Ok="; 40 - fetchSubmodules = true; 41 - }; 48 + eaSrcRehydrated = fetchgit { 49 + url = eaGitSrc; 50 + fetchSubmodules = true; 51 + hash = sources.ea.fullHash; 52 + }; 53 + 54 + in { 55 + mainline = qt6Packages.callPackage ./generic.nix { 56 + branch = "mainline"; 57 + version = sources.mainline.version; 58 + src = mainlineSrc; 59 + inherit compat-list; 60 + }; 42 61 43 - inherit branch compat-list; 62 + early-access = qt6Packages.callPackage ./generic.nix { 63 + branch = "early-access"; 64 + version = sources.ea.version; 65 + src = eaSrcRehydrated; 66 + inherit compat-list; 44 67 }; 45 68 }.${branch}
+51 -37
pkgs/applications/emulators/yuzu/generic.nix
··· 1 - { pname 2 - , version 1 + { version 3 2 , src 4 3 , branch 5 4 , compat-list 6 5 7 6 , lib 8 7 , stdenv 9 - , runCommandLocal 10 - , substituteAll 11 8 , wrapQtAppsHook 12 9 , alsa-lib 13 10 , boost 14 - , catch2 11 + , catch2_3 15 12 , cmake 13 + , cpp-jwt 14 + , cubeb 15 + , discord-rpc 16 16 , doxygen 17 + , enet 17 18 , ffmpeg 18 - , fmt_8 19 + , fmt 19 20 , glslang 21 + , httplib 22 + , inih 20 23 , libjack2 21 24 , libopus 22 25 , libpulseaudio ··· 29 32 , pkg-config 30 33 , python3 31 34 , qtbase 35 + , qtmultimedia 32 36 , qttools 37 + , qtwayland 33 38 , qtwebengine 34 39 , rapidjson 35 40 , SDL2 ··· 42 47 , zstd 43 48 }: 44 49 45 - stdenv.mkDerivation rec { 46 - inherit pname version src; 50 + stdenv.mkDerivation { 51 + pname = "yuzu-${branch}"; 52 + 53 + inherit version src; 47 54 48 55 nativeBuildInputs = [ 49 56 cmake ··· 57 64 buildInputs = [ 58 65 alsa-lib 59 66 boost 60 - catch2 67 + catch2_3 68 + cpp-jwt 69 + cubeb 70 + discord-rpc 71 + # intentionally omitted: dynarmic - prefer vendored version for compatibility 72 + enet 61 73 ffmpeg 62 - fmt_8 74 + fmt 63 75 glslang 76 + httplib 77 + inih 64 78 libjack2 65 79 libopus 66 80 libpulseaudio 67 81 libusb1 68 82 libva 69 83 libzip 84 + # intentionally omitted: LLVM - heavy, only used for stack traces in the debugger 70 85 lz4 71 86 nlohmann_json 72 87 qtbase 88 + qtmultimedia 73 89 qttools 90 + qtwayland 74 91 qtwebengine 75 92 rapidjson 76 93 SDL2 77 94 sndio 78 95 speexdsp 79 96 udev 97 + vulkan-headers 98 + # intentionally omitted: xbyak - prefer vendored version for compatibility 80 99 zlib 81 100 zstd 82 101 ]; 83 102 84 - doCheck = true; 85 - 86 103 # This changes `ir/opt` to `ir/var/empty` in `externals/dynarmic/src/dynarmic/CMakeLists.txt` 87 104 # making the build fail, as that path does not exist 88 105 dontFixCmake = true; 89 106 90 - # -Werror causes build failures for deprecation warnings introduced by transitive dependency updates 91 - postPatch = '' 92 - sed -i '/-Werror/d' src/common/CMakeLists.txt 93 - ''; 94 - 95 107 cmakeFlags = [ 96 - "-DYUZU_USE_BUNDLED_QT=OFF" 97 - "-DYUZU_USE_BUNDLED_FFMPEG=OFF" 98 - "-DYUZU_USE_BUNDLED_OPUS=OFF" 99 - "-DYUZU_USE_EXTERNAL_SDL2=OFF" 108 + # actually has a noticeable performance impact 109 + "-DYUZU_ENABLE_LTO=ON" 100 110 111 + # build with qt6 112 + "-DENABLE_QT6=ON" 101 113 "-DENABLE_QT_TRANSLATION=ON" 114 + 115 + # use system libraries 116 + "-DYUZU_USE_EXTERNAL_SDL2=OFF" 117 + "-DYUZU_USE_EXTERNAL_VULKAN_HEADERS=OFF" 118 + 119 + # don't check for missing submodules 120 + "-DYUZU_CHECK_SUBMODULES=OFF" 121 + 122 + # enable some optional features 102 123 "-DYUZU_USE_QT_WEB_ENGINE=ON" 124 + "-DYUZU_USE_QT_MULTIMEDIA=ON" 103 125 "-DUSE_DISCORD_PRESENCE=ON" 104 126 105 127 # We dont want to bother upstream with potentially outdated compat reports ··· 107 129 "-DENABLE_COMPATIBILITY_LIST_DOWNLOAD=OFF" # We provide this deterministically 108 130 ]; 109 131 132 + # Fixes vulkan detection. 133 + # FIXME: patchelf --add-rpath corrupts the binary for some reason, investigate 110 134 qtWrapperArgs = [ 111 - # Fixes vulkan detection 112 135 "--prefix LD_LIBRARY_PATH : ${vulkan-loader}/lib" 113 - # Without yuzu doesnt start on wayland. See https://github.com/yuzu-emu/yuzu/issues/6088 114 - "--set QT_QPA_PLATFORM xcb" 115 136 ]; 116 137 117 138 preConfigure = '' 118 - # This prevents a check for submodule directories. 119 - rm -f .gitmodules 120 - 121 139 # see https://github.com/NixOS/nixpkgs/issues/114044, setting this through cmakeFlags does not work. 122 140 cmakeFlagsArray+=( 123 - "-DTITLE_BAR_FORMAT_IDLE=yuzu ${branch} ${version}" 124 - "-DTITLE_BAR_FORMAT_RUNNING=yuzu ${branch} ${version} | {3}" 141 + "-DTITLE_BAR_FORMAT_IDLE=yuzu | ${branch} ${version} (nixpkgs) {}" 142 + "-DTITLE_BAR_FORMAT_RUNNING=yuzu | ${branch} ${version} (nixpkgs) | {}" 125 143 ) 126 144 ''; 127 145 ··· 130 148 ln -sf ${compat-list} ./dist/compatibility_list/compatibility_list.json 131 149 ''; 132 150 133 - passthru.updateScript = runCommandLocal "yuzu-${branch}-updateScript" { 134 - script = substituteAll { 135 - src = ./update.sh; 136 - inherit branch; 137 - }; 138 - } "install -Dm755 $script $out"; 151 + passthru.updateScript = ./update.sh; 139 152 140 153 meta = with lib; { 141 154 homepage = "https://yuzu-emu.org"; ··· 143 156 description = "The ${branch} branch of an experimental Nintendo Switch emulator written in C++"; 144 157 longDescription = '' 145 158 An experimental Nintendo Switch emulator written in C++. 146 - Using the mainline branch is recommanded for general usage. 147 - Using the early-access branch is recommanded if you would like to try out experimental features, with a cost of stability. 159 + Using the mainline branch is recommended for general usage. 160 + Using the early-access branch is recommended if you would like to try out experimental features, with a cost of stability. 148 161 ''; 149 162 mainProgram = "yuzu"; 150 163 platforms = [ "x86_64-linux" ]; ··· 158 171 ivar 159 172 joshuafern 160 173 sbruder 174 + k900 161 175 ]; 162 176 }; 163 177 }
+19
pkgs/applications/emulators/yuzu/sources.nix
··· 1 + # Generated by ./update.sh - do not update manually! 2 + # Last updated: 2023-05-05 3 + { 4 + compatList = { 5 + rev = "773d28cbc699427c8baa427452d7b229920eec59"; 6 + hash = "sha256:1hdsza3wf9a0yvj6h55gsl7xqvhafvbz1i8paz9kg7l49b0gnlh1"; 7 + }; 8 + 9 + mainline = { 10 + version = "1421"; 11 + hash = "sha256:1ldxframs7a8rmna9ymyx20n89594q0d1266kr7ah8yvh1gp04r3"; 12 + }; 13 + 14 + ea = { 15 + version = "3557"; 16 + distHash = "sha256:0bddx5d88cfaaqbzr59w9kqjjsf9xvgvdn1g0l9w3ifr9zc2vlwr"; 17 + fullHash = "sha256:0w1ji3a8iridh4dpyal8lscgwddf9pwz1pfigksmvbn8mm9d9xwl"; 18 + }; 19 + }
+47 -86
pkgs/applications/emulators/yuzu/update.sh
··· 1 1 #! /usr/bin/env nix-shell 2 - #! nix-shell -I nixpkgs=./. -i bash -p nix nix-prefetch-git coreutils curl jq gnused 2 + #! nix-shell -i bash -p nix nix-prefetch-git gnutar curl jq 3 3 4 4 set -euo pipefail 5 5 6 - # Will be replaced with the actual branch when running this from passthru.updateScript 7 - BRANCH="@branch@" 8 - DEFAULT_NIX="$(dirname "${BASH_SOURCE[@]}")/default.nix" 6 + cd "$(dirname "$(readlink -f "$0")")" 9 7 10 - if [[ "$(basename "$PWD")" = "yuzu" ]]; then 11 - echo "error: Script must be ran from nixpkgs's root directory for compatibility with the maintainer script" 12 - exit 1 13 - fi 8 + log() { 9 + tput bold 10 + echo "#" "$@" 11 + tput sgr0 12 + } 14 13 15 - updateBranch() { 16 - local branch attribute oldVersion oldHash newVersion newHash 17 - branch="$1" 18 - attribute="yuzu-$branch" 19 - [[ "$branch" = "early-access" ]] && attribute="yuzu-ea" # Attribute path doesnt match the branch name 20 - oldVersion="$(nix eval --raw -f "./default.nix" "$attribute".version)" 21 - oldHash="$(nix eval --raw -f "./default.nix" "$attribute".src.drvAttrs.outputHash)" 14 + alias curl='curl -s ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"}' 22 15 23 - if [[ "$branch" = "mainline" ]]; then 24 - newVersion="$(curl -s ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} "https://api.github.com/repos/yuzu-emu/yuzu-mainline/releases?per_page=1" \ 25 - | jq -r '.[0].name' | cut -d" " -f2)" 26 - elif [[ "$branch" = "early-access" ]]; then 27 - newVersion="$(curl -s ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} "https://api.github.com/repos/pineappleEA/pineapple-src/releases?per_page=2" \ 28 - | jq -r '.[].tag_name' | grep '^EA-[0-9]*' | head -n1 | cut -d"-" -f2 | cut -d" " -f1)" 29 - fi 16 + log "Updating compatibility list..." 17 + compatListRev="$(curl "https://api.github.com/repos/flathub/org.yuzu_emu.yuzu/commits/master" | jq -r '.sha')" 30 18 31 - if [[ "${oldVersion}" = "${newVersion}" ]]; then 32 - echo "$attribute is already up to date." 33 - return 34 - else 35 - echo "$attribute: ${oldVersion} -> ${newVersion}" 36 - fi 19 + log "Downloading rev: ${compatListRev}" 20 + compatListHash="$(nix-prefetch-url "https://raw.githubusercontent.com/flathub/org.yuzu_emu.yuzu/${compatListRev}/compatibility_list.json")" 37 21 38 - echo " fetching source code to generate hash..." 39 - if [[ "$branch" = "mainline" ]]; then 40 - newHash="$(nix-prefetch-git --quiet --fetch-submodules --rev "mainline-0-${newVersion}" "https://github.com/yuzu-emu/yuzu-mainline" | jq -r '.sha256')" 41 - elif [[ "$branch" = "early-access" ]]; then 42 - newHash="$(nix-prefetch-git --quiet --fetch-submodules --rev "EA-${newVersion}" "https://github.com/pineappleEA/pineapple-src" | jq -r '.sha256')" 43 - fi 44 - newHash="$(nix hash to-sri --type sha256 "${newHash}")" 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)" 45 24 46 - sed -i "s,${oldVersion},${newVersion}," "$DEFAULT_NIX" 47 - sed -i "s,${oldHash},${newHash},g" "$DEFAULT_NIX" 48 - echo " successfully updated $attribute. new hash: $newHash" 49 - } 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')" 50 27 51 - updateCompatibilityList() { 52 - local latestRevision oldUrl newUrl oldHash newHash oldDate newDate 53 - latestRevision="$(curl -s ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} "https://api.github.com/repos/flathub/org.yuzu_emu.yuzu/commits/master" | jq -r '.sha')" 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)" 54 30 55 - oldUrl="$(sed -n '/yuzu-compat-list/,/url/p' "$DEFAULT_NIX" | tail -n1 | cut -d'"' -f2)" 56 - newUrl="https://raw.githubusercontent.com/flathub/org.yuzu_emu.yuzu/${latestRevision}/compatibility_list.json" 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")" 57 33 58 - oldDate="$(sed -n '/last updated.*/p' "$DEFAULT_NIX" | rev | cut -d' ' -f1 | rev)" 59 - newDate="$(curl -s ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} "https://api.github.com/repos/flathub/org.yuzu_emu.yuzu/commits/${latestRevision}" \ 60 - | jq -r '.commit.committer.date' | cut -d'T' -f1)" 34 + eaDistHash="$(echo "${fetched}" | head -n1)" 35 + eaDist="$(echo "${fetched}" | tail -n1)" 61 36 62 - oldHash="$(sed -n '/yuzu-compat-list/,/sha256/p' "$DEFAULT_NIX" | tail -n1 | cut -d'"' -f2)" 63 - newHash="$(nix hash to-sri --type sha256 "$(nix-prefetch-url --quiet "$newUrl")")" 37 + eaDistUnpacked="$(mktemp -d)" 38 + trap 'rm -rf "$eaDistUnpacked"' EXIT 64 39 65 - if [[ "$oldHash" = "$newHash" ]]; then 66 - echo "compatibility_list is already up to date." 67 - return 68 - else 69 - echo "compatibility_list: $oldDate -> $newDate" 70 - fi 40 + log "Unpacking dist..." 41 + tar xf "$eaDist"/*.tar.xz --directory="$eaDistUnpacked" --strip-components=1 71 42 72 - sed -i "s,${oldUrl},${newUrl},g" "$DEFAULT_NIX" 73 - sed -i "s,${oldHash},${newHash},g" "$DEFAULT_NIX" 74 - sed -i "s,${oldDate},${newDate},g" "$DEFAULT_NIX" 75 - echo " successfully updated compatibility_list. new hash: $newHash" 76 - } 43 + log "Rehydrating..." 44 + eaFullHash="$(nix-prefetch-git --fetch-submodules "$eaDistUnpacked" | jq -r '.sha256')" 77 45 78 - if [[ "$BRANCH" = "mainline" ]] || [[ "$BRANCH" = "early-access" ]]; then 79 - updateBranch "$BRANCH" 80 - updateCompatibilityList 81 - else # Script is not ran from passthru.updateScript 82 - if (( $# == 0 )); then 83 - updateBranch "mainline" 84 - updateBranch "early-access" 85 - fi 46 + cat >sources.nix <<EOF 47 + # Generated by ./update.sh - do not update manually! 48 + # Last updated: $(date +%F) 49 + { 50 + compatList = { 51 + rev = "$compatListRev"; 52 + hash = "sha256:$compatListHash"; 53 + }; 86 54 87 - while (( "$#" > 0 )); do 88 - case "$1" in 89 - mainline|yuzu-mainline) 90 - updateBranch "mainline" 91 - ;; 92 - early-access|yuzu-early-access|ea|yuzu-ea) 93 - updateBranch "early-access" 94 - ;; 95 - *) 96 - echo "error: invalid branch: $1." 97 - echo "usage: $(basename "$0") [mainline|early-access]" 98 - exit 1 99 - ;; 100 - esac 101 - shift 102 - done 55 + mainline = { 56 + version = "$mainlineVersion"; 57 + hash = "sha256:$mainlineHash"; 58 + }; 103 59 104 - updateCompatibilityList 105 - fi 60 + ea = { 61 + version = "$eaVersion"; 62 + distHash = "sha256:$eaDistHash"; 63 + fullHash = "sha256:$eaFullHash"; 64 + }; 65 + } 66 + EOF
+2 -4
pkgs/top-level/all-packages.nix
··· 2467 2467 2468 2468 ### APPLICATIONS/EMULATORS/YUZU 2469 2469 2470 - yuzu-mainline = import ../applications/emulators/yuzu { 2470 + yuzu-mainline = qt6Packages.callPackage ../applications/emulators/yuzu { 2471 2471 branch = "mainline"; 2472 - inherit libsForQt5 fetchFromGitHub fetchurl; 2473 2472 }; 2474 2473 2475 - yuzu-early-access = import ../applications/emulators/yuzu { 2474 + yuzu-early-access = qt6Packages.callPackage ../applications/emulators/yuzu { 2476 2475 branch = "early-access"; 2477 - inherit libsForQt5 fetchFromGitHub fetchurl; 2478 2476 }; 2479 2477 2480 2478 ### APPLICATIONS/EMULATORS/COMMANDERX16