Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
May 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 53 additions & 30 deletions pkgs/applications/emulators/yuzu/default.nix
Original file line number Diff line number Diff line change
@@ -1,45 +1,68 @@
{ branch ? "mainline"
, libsForQt5
, qt6Packages
, fetchFromGitHub
, fetchgit
, fetchurl
, fetchzip
, runCommand
, gnutar
}:

let
# Mirror of https://api.yuzu-emu.org/gamedb, last updated 2022-08-13
# Please make sure to update this when updating yuzu!
sources = import ./sources.nix;

compat-list = fetchurl {
name = "yuzu-compat-list";
url = "https://raw.githubusercontent.com/flathub/org.yuzu_emu.yuzu/d83401d2ee3fd5e1922e31baed1f3bdb1c0f036c/compatibility_list.json";
sha256 = "sha256-anOmO7NscHDsQxT03+YbJEyBkXjhcSVGgKpDwt//GHw=";
url = "https://raw.githubusercontent.com/flathub/org.yuzu_emu.yuzu/${sources.compatList.rev}/compatibility_list.json";
hash = sources.compatList.hash;
};
in {
mainline = libsForQt5.callPackage ./generic.nix rec {
pname = "yuzu-mainline";
version = "1245";

src = fetchFromGitHub {
owner = "yuzu-emu";
repo = "yuzu-mainline";
rev = "mainline-0-${version}";
sha256 = "sha256-lWXlY1KQC067MvCRUFhmr0c7KDrHDuwJOhIWMKw1f+A=";
fetchSubmodules = true;
};

inherit branch compat-list;

mainlineSrc = fetchFromGitHub {
owner = "yuzu-emu";
repo = "yuzu-mainline";
rev = "mainline-0-${sources.mainline.version}";
hash = sources.mainline.hash;
fetchSubmodules = true;
};

# The mirror repo for early access builds is missing submodule info,
# but the Windows distributions include a source tarball, which in turn
# includes the full git metadata. So, grab that and rehydrate it.
# This has the unfortunate side effect of requiring two FODs, one
# for the Windows download and one for the full repo with submodules.
eaZip = fetchzip {
name = "yuzu-ea-windows-dist";
url = "https://github.com/pineappleEA/pineapple-src/releases/download/EA-${sources.ea.version}/Windows-Yuzu-EA-${sources.ea.version}.zip";
hash = sources.ea.distHash;
};

early-access = libsForQt5.callPackage ./generic.nix rec {
pname = "yuzu-ea";
version = "2945";
eaGitSrc = runCommand "yuzu-ea-dist-unpacked" {
src = eaZip;
nativeBuildInputs = [ gnutar ];
}
''
mkdir $out
tar xf $src/*.tar.xz --directory=$out --strip-components=1
'';

src = fetchFromGitHub {
owner = "pineappleEA";
repo = "pineapple-src";
rev = "EA-${version}";
sha256 = "sha256-/051EtQxhB5oKH/JxZZ2AjnxOBcRxCBIwd4Qr8lq7Ok=";
fetchSubmodules = true;
};
eaSrcRehydrated = fetchgit {
url = eaGitSrc;
fetchSubmodules = true;
hash = sources.ea.fullHash;
};

in {
mainline = qt6Packages.callPackage ./generic.nix {
branch = "mainline";
version = sources.mainline.version;
src = mainlineSrc;
inherit compat-list;
};

inherit branch compat-list;
early-access = qt6Packages.callPackage ./generic.nix {
branch = "early-access";
version = sources.ea.version;
src = eaSrcRehydrated;
inherit compat-list;
};
}.${branch}
88 changes: 51 additions & 37 deletions pkgs/applications/emulators/yuzu/generic.nix
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
{ pname
, version
{ version
, src
, branch
, compat-list

, lib
, stdenv
, runCommandLocal
, substituteAll
, wrapQtAppsHook
, alsa-lib
, boost
, catch2
, catch2_3
, cmake
, cpp-jwt
, cubeb
, discord-rpc
, doxygen
, enet
, ffmpeg
, fmt_8
, fmt
, glslang
, httplib
, inih
, libjack2
, libopus
, libpulseaudio
Expand All @@ -29,7 +32,9 @@
, pkg-config
, python3
, qtbase
, qtmultimedia
, qttools
, qtwayland
, qtwebengine
, rapidjson
, SDL2
Expand All @@ -42,8 +47,10 @@
, zstd
}:

stdenv.mkDerivation rec {
inherit pname version src;
stdenv.mkDerivation {
pname = "yuzu-${branch}";

inherit version src;

nativeBuildInputs = [
cmake
Expand All @@ -57,71 +64,82 @@ stdenv.mkDerivation rec {
buildInputs = [
alsa-lib
boost
catch2
catch2_3
cpp-jwt
cubeb
discord-rpc
# intentionally omitted: dynarmic - prefer vendored version for compatibility
enet
ffmpeg
fmt_8
fmt
glslang
httplib
inih
libjack2
libopus
libpulseaudio
libusb1
libva
libzip
# intentionally omitted: LLVM - heavy, only used for stack traces in the debugger
lz4
nlohmann_json
qtbase
qtmultimedia
qttools
qtwayland
qtwebengine
rapidjson
SDL2
sndio
speexdsp
udev
vulkan-headers
# intentionally omitted: xbyak - prefer vendored version for compatibility
zlib
zstd
];

doCheck = true;

# This changes `ir/opt` to `ir/var/empty` in `externals/dynarmic/src/dynarmic/CMakeLists.txt`
# making the build fail, as that path does not exist
dontFixCmake = true;

# -Werror causes build failures for deprecation warnings introduced by transitive dependency updates
postPatch = ''
sed -i '/-Werror/d' src/common/CMakeLists.txt
'';

cmakeFlags = [
"-DYUZU_USE_BUNDLED_QT=OFF"
"-DYUZU_USE_BUNDLED_FFMPEG=OFF"
"-DYUZU_USE_BUNDLED_OPUS=OFF"
"-DYUZU_USE_EXTERNAL_SDL2=OFF"
# actually has a noticeable performance impact
"-DYUZU_ENABLE_LTO=ON"

# build with qt6
"-DENABLE_QT6=ON"
"-DENABLE_QT_TRANSLATION=ON"

# use system libraries
"-DYUZU_USE_EXTERNAL_SDL2=OFF"
lheckemann marked this conversation as resolved.
Show resolved Hide resolved
"-DYUZU_USE_EXTERNAL_VULKAN_HEADERS=OFF"

# don't check for missing submodules
"-DYUZU_CHECK_SUBMODULES=OFF"

# enable some optional features
"-DYUZU_USE_QT_WEB_ENGINE=ON"
"-DYUZU_USE_QT_MULTIMEDIA=ON"
"-DUSE_DISCORD_PRESENCE=ON"

# We dont want to bother upstream with potentially outdated compat reports
"-DYUZU_ENABLE_COMPATIBILITY_REPORTING=OFF"
"-DENABLE_COMPATIBILITY_LIST_DOWNLOAD=OFF" # We provide this deterministically
];

# Fixes vulkan detection.
# FIXME: patchelf --add-rpath corrupts the binary for some reason, investigate
qtWrapperArgs = [
# Fixes vulkan detection
"--prefix LD_LIBRARY_PATH : ${vulkan-loader}/lib"
# Without yuzu doesnt start on wayland. See https://github.com/yuzu-emu/yuzu/issues/6088
"--set QT_QPA_PLATFORM xcb"
];

preConfigure = ''
# This prevents a check for submodule directories.
rm -f .gitmodules

# see https://github.com/NixOS/nixpkgs/issues/114044, setting this through cmakeFlags does not work.
cmakeFlagsArray+=(
"-DTITLE_BAR_FORMAT_IDLE=yuzu ${branch} ${version}"
"-DTITLE_BAR_FORMAT_RUNNING=yuzu ${branch} ${version} | {3}"
"-DTITLE_BAR_FORMAT_IDLE=yuzu | ${branch} ${version} (nixpkgs) {}"
"-DTITLE_BAR_FORMAT_RUNNING=yuzu | ${branch} ${version} (nixpkgs) | {}"
)
'';

Expand All @@ -130,21 +148,16 @@ stdenv.mkDerivation rec {
ln -sf ${compat-list} ./dist/compatibility_list/compatibility_list.json
'';

passthru.updateScript = runCommandLocal "yuzu-${branch}-updateScript" {
script = substituteAll {
src = ./update.sh;
inherit branch;
};
} "install -Dm755 $script $out";
passthru.updateScript = ./update.sh;

meta = with lib; {
homepage = "https://yuzu-emu.org";
changelog = "https://yuzu-emu.org/entry";
description = "The ${branch} branch of an experimental Nintendo Switch emulator written in C++";
longDescription = ''
An experimental Nintendo Switch emulator written in C++.
Using the mainline branch is recommanded for general usage.
Using the early-access branch is recommanded if you would like to try out experimental features, with a cost of stability.
Using the mainline branch is recommended for general usage.
Using the early-access branch is recommended if you would like to try out experimental features, with a cost of stability.
'';
mainProgram = "yuzu";
platforms = [ "x86_64-linux" ];
Expand All @@ -158,6 +171,7 @@ stdenv.mkDerivation rec {
ivar
joshuafern
sbruder
k900
];
};
}
19 changes: 19 additions & 0 deletions pkgs/applications/emulators/yuzu/sources.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by ./update.sh - do not update manually!
# Last updated: 2023-05-05
{
compatList = {
rev = "773d28cbc699427c8baa427452d7b229920eec59";
hash = "sha256:1hdsza3wf9a0yvj6h55gsl7xqvhafvbz1i8paz9kg7l49b0gnlh1";
};

mainline = {
version = "1421";
hash = "sha256:1ldxframs7a8rmna9ymyx20n89594q0d1266kr7ah8yvh1gp04r3";
};

ea = {
version = "3557";
distHash = "sha256:0bddx5d88cfaaqbzr59w9kqjjsf9xvgvdn1g0l9w3ifr9zc2vlwr";
fullHash = "sha256:0w1ji3a8iridh4dpyal8lscgwddf9pwz1pfigksmvbn8mm9d9xwl";
};
}
Loading