From af92d6c5f6f7e8ec76e58c93d207099077754de4 Mon Sep 17 00:00:00 2001 From: Marcin Serwin Date: Sun, 26 Jan 2025 01:28:18 +0100 Subject: [PATCH 1/6] torzu: use system vulkan libraries --- pkgs/by-name/to/torzu/package.nix | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/to/torzu/package.nix b/pkgs/by-name/to/torzu/package.nix index 06cd23badc4e..755c4b4d2cfb 100644 --- a/pkgs/by-name/to/torzu/package.nix +++ b/pkgs/by-name/to/torzu/package.nix @@ -27,6 +27,9 @@ nv-codec-headers-12, pkg-config, qt6, + spirv-tools, + spirv-headers, + vulkan-utility-libraries, vulkan-headers, vulkan-loader, yasm, @@ -147,7 +150,10 @@ stdenv.mkDerivation (finalAttrs: { # intentionally omitted: renderdoc - heavy, developer only SDL2 # intentionally omitted: stb - header only libraries, vendor uses git snapshot + spirv-tools + spirv-headers vulkan-memory-allocator + vulkan-utility-libraries # intentionally omitted: xbyak - prefer vendored version for compatibility zlib zstd @@ -167,10 +173,11 @@ stdenv.mkDerivation (finalAttrs: { # use system libraries # NB: "external" here means "from the externals/ directory in the source", - # so "off" means "use system" + # so "false" means "use system" (lib.cmakeBool "YUZU_USE_EXTERNAL_SDL2" false) - (lib.cmakeBool "YUZU_USE_EXTERNAL_VULKAN_HEADERS" true) - "-DVulkan_INCLUDE_DIRS=${vulkan-headers}/include" + (lib.cmakeBool "YUZU_USE_EXTERNAL_VULKAN_HEADERS" false) + (lib.cmakeBool "YUZU_USE_EXTERNAL_VULKAN_UTILITY_LIBRARIES" false) + (lib.cmakeBool "YUZU_USE_EXTERNAL_VULKAN_SPIRV_TOOLS" false) # # don't use system ffmpeg, suyu uses internal APIs # (lib.cmakeBool "YUZU_USE_BUNDLED_FFMPEG" true) From 069a69ca406fd77a55a4b78d6a355e11ca7d4bdc Mon Sep 17 00:00:00 2001 From: Marcin Serwin Date: Sun, 26 Jan 2025 01:40:51 +0100 Subject: [PATCH 2/6] torzu: remove old ffmpeg code --- pkgs/by-name/to/torzu/package.nix | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/pkgs/by-name/to/torzu/package.nix b/pkgs/by-name/to/torzu/package.nix index 755c4b4d2cfb..1f918384b046 100644 --- a/pkgs/by-name/to/torzu/package.nix +++ b/pkgs/by-name/to/torzu/package.nix @@ -2,7 +2,6 @@ lib, stdenv, SDL2, - autoconf, boost, catch2_3, cmake, @@ -18,13 +17,11 @@ glslang, libopus, libusb1, - libva, lz4, python3, unzip, nix-update-script, nlohmann_json, - nv-codec-headers-12, pkg-config, qt6, spirv-tools, @@ -32,7 +29,6 @@ vulkan-utility-libraries, vulkan-headers, vulkan-loader, - yasm, simpleini, zlib, vulkan-memory-allocator, @@ -126,15 +122,7 @@ stdenv.mkDerivation (finalAttrs: { # intentionally omitted: dynarmic - prefer vendored version for compatibility enet - # ffmpeg deps (also includes vendored) - # we do not use internal ffmpeg because cuda errors - autoconf - yasm - libva # for accelerated video decode on non-nvidia - nv-codec-headers-12 # for accelerated video decode on nvidia ffmpeg-headless - # end ffmpeg deps - fmt # intentionally omitted: gamemode - loaded dynamically at runtime # intentionally omitted: httplib - upstream requires an older version than what we have @@ -179,9 +167,6 @@ stdenv.mkDerivation (finalAttrs: { (lib.cmakeBool "YUZU_USE_EXTERNAL_VULKAN_UTILITY_LIBRARIES" false) (lib.cmakeBool "YUZU_USE_EXTERNAL_VULKAN_SPIRV_TOOLS" false) - # # don't use system ffmpeg, suyu uses internal APIs - # (lib.cmakeBool "YUZU_USE_BUNDLED_FFMPEG" true) - # don't check for missing submodules (lib.cmakeBool "YUZU_CHECK_SUBMODULES" false) From 89f0fa2faa2f9f5402fcb9642dd0b1aea180efca Mon Sep 17 00:00:00 2001 From: Marcin Serwin Date: Sun, 26 Jan 2025 01:47:56 +0100 Subject: [PATCH 3/6] torzu: use structured args --- pkgs/by-name/to/torzu/package.nix | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/pkgs/by-name/to/torzu/package.nix b/pkgs/by-name/to/torzu/package.nix index 1f918384b046..100d676153ab 100644 --- a/pkgs/by-name/to/torzu/package.nix +++ b/pkgs/by-name/to/torzu/package.nix @@ -151,6 +151,7 @@ stdenv.mkDerivation (finalAttrs: { # making the build fail, as that path does not exist dontFixCmake = true; + __structuredAttrs = true; cmakeFlags = [ # actually has a noticeable performance impact (lib.cmakeBool "YUZU_ENABLE_LTO" true) @@ -178,6 +179,9 @@ stdenv.mkDerivation (finalAttrs: { # We dont want to bother upstream with potentially outdated compat reports (lib.cmakeBool "YUZU_ENABLE_COMPATIBILITY_REPORTING" false) (lib.cmakeBool "ENABLE_COMPATIBILITY_LIST_DOWNLOAD" false) # We provide this deterministically + + (lib.cmakeFeature "TITLE_BAR_FORMAT_IDLE" "${finalAttrs.pname} | ${finalAttrs.version} (nixpkgs) {}") + (lib.cmakeFeature "TITLE_BAR_FORMAT_RUNNING" "${finalAttrs.pname} | ${finalAttrs.version} (nixpkgs) | {}") ]; env = { @@ -191,21 +195,11 @@ stdenv.mkDerivation (finalAttrs: { "--prefix LD_LIBRARY_PATH : ${vulkan-loader}/lib" ]; - # Setting this through cmakeFlags does not work. - # https://github.com/NixOS/nixpkgs/issues/114044 - preConfigure = lib.concatStringsSep "\n" [ - '' - cmakeFlagsArray+=( - "-DTITLE_BAR_FORMAT_IDLE=${finalAttrs.pname} | ${finalAttrs.version} (nixpkgs) {}" - "-DTITLE_BAR_FORMAT_RUNNING=${finalAttrs.pname} | ${finalAttrs.version} (nixpkgs) | {}" - ) - '' + preConfigure = '' # provide pre-downloaded tz data - '' - mkdir -p build/externals/nx_tzdb - ln -s ${nx_tzdb} build/externals/nx_tzdb/nx_tzdb - '' - ]; + mkdir -p build/externals/nx_tzdb + ln -s ${nx_tzdb} build/externals/nx_tzdb/nx_tzdb + ''; postConfigure = '' ln -sf ${compat-list} ./dist/compatibility_list/compatibility_list.json From d0460eb15a406f235c5a571e7f1cbfe4ea02f6a1 Mon Sep 17 00:00:00 2001 From: Marcin Serwin Date: Sun, 26 Jan 2025 11:03:34 +0100 Subject: [PATCH 4/6] simpleini: cherry pick cmake fixes from master --- pkgs/by-name/si/simpleini/package.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/by-name/si/simpleini/package.nix b/pkgs/by-name/si/simpleini/package.nix index 8982c1f53a8d..358dba6d3640 100644 --- a/pkgs/by-name/si/simpleini/package.nix +++ b/pkgs/by-name/si/simpleini/package.nix @@ -2,6 +2,7 @@ lib, stdenv, fetchFromGitHub, + fetchpatch, cmake, gtest, nix-update-script, @@ -31,6 +32,14 @@ stdenv.mkDerivation (finalAttrs: { cmakeFlags = [ (lib.cmakeBool "SIMPLEINI_USE_SYSTEM_GTEST" true) ]; + patches = [ + # Fixes for cmake export from master, can be removed after the next release + (fetchpatch { + url = "https://github.com/brofield/simpleini/commit/aeacf861a8ad8add5f4974792a88ffea393e41db.patch"; + hash = "sha256-lpoQHff8JwfljMUxL6Y2MqsGDZtDPjnOIKSIJ1rqrAI="; + }) + ]; + passthru.updateScript = nix-update-script { }; meta = { From 97ef6bd4debbc9bc3ee81921a12083d073406cd6 Mon Sep 17 00:00:00 2001 From: Marcin Serwin Date: Sun, 26 Jan 2025 11:03:34 +0100 Subject: [PATCH 5/6] torzu: use simpleini from system --- pkgs/by-name/to/torzu/package.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/by-name/to/torzu/package.nix b/pkgs/by-name/to/torzu/package.nix index 100d676153ab..630edceb8122 100644 --- a/pkgs/by-name/to/torzu/package.nix +++ b/pkgs/by-name/to/torzu/package.nix @@ -138,6 +138,7 @@ stdenv.mkDerivation (finalAttrs: { # intentionally omitted: renderdoc - heavy, developer only SDL2 # intentionally omitted: stb - header only libraries, vendor uses git snapshot + simpleini spirv-tools spirv-headers vulkan-memory-allocator From 076c670e2f7d8865ed40949dbf4ea7b653e6e284 Mon Sep 17 00:00:00 2001 From: Marcin Serwin Date: Sun, 2 Feb 2025 02:14:00 +0100 Subject: [PATCH 6/6] Fix building on aarch64-linux --- .../by-name/to/torzu/fix-aarch64-linux-build.patch | 14 ++++++++++++++ pkgs/by-name/to/torzu/package.nix | 6 ++---- 2 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 pkgs/by-name/to/torzu/fix-aarch64-linux-build.patch diff --git a/pkgs/by-name/to/torzu/fix-aarch64-linux-build.patch b/pkgs/by-name/to/torzu/fix-aarch64-linux-build.patch new file mode 100644 index 000000000000..11d4a0a4ea2d --- /dev/null +++ b/pkgs/by-name/to/torzu/fix-aarch64-linux-build.patch @@ -0,0 +1,14 @@ +diff --git a/src/video_core/host1x/vic.cpp b/src/video_core/host1x/vic.cpp +index 3ad56bb80..57e6adbf8 100644 +--- a/src/video_core/host1x/vic.cpp ++++ b/src/video_core/host1x/vic.cpp +@@ -13,7 +13,8 @@ + #endif + #elif defined(ARCHITECTURE_arm64) + #pragma GCC diagnostic push +-#pragma GCC diagnostic ignored "-Wimplicit-int-conversion" ++#pragma GCC diagnostic ignored "-Wconversion" ++#pragma GCC diagnostic ignored "-Wshadow" + #include + #pragma GCC diagnostic pop + #endif diff --git a/pkgs/by-name/to/torzu/package.nix b/pkgs/by-name/to/torzu/package.nix index 630edceb8122..e51be62e37d4 100644 --- a/pkgs/by-name/to/torzu/package.nix +++ b/pkgs/by-name/to/torzu/package.nix @@ -98,6 +98,8 @@ stdenv.mkDerivation (finalAttrs: { ./fix-udp-protocol.patch # Use specific boost::asio includes and update to modern io_context ./fix-udp-client.patch + # Updates suppressed diagnostics + ./fix-aarch64-linux-build.patch ]; nativeBuildInputs = [ @@ -215,10 +217,6 @@ stdenv.mkDerivation (finalAttrs: { homepage = "https://notabug.org/litucks/torzu"; mainProgram = "yuzu"; platforms = lib.platforms.linux; - badPlatforms = [ - # Several conversion errors, probably caused by the update to GCC 14 - "aarch64-linux" - ]; maintainers = with lib.maintainers; [ liberodark ]; license = with lib.licenses; [ gpl3Plus