From 56a75ae59ff263eb91ceeaa280046f4992c50a77 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Mon, 17 Jun 2024 15:08:55 -0300 Subject: [PATCH 1/5] cemu: migrate to by-name --- .../emulators => by-name/ce}/cemu/cmakelists.patch | 0 .../emulators/cemu/default.nix => by-name/ce/cemu/package.nix} | 0 pkgs/top-level/all-packages.nix | 2 -- 3 files changed, 2 deletions(-) rename pkgs/{applications/emulators => by-name/ce}/cemu/cmakelists.patch (100%) rename pkgs/{applications/emulators/cemu/default.nix => by-name/ce/cemu/package.nix} (100%) diff --git a/pkgs/applications/emulators/cemu/cmakelists.patch b/pkgs/by-name/ce/cemu/cmakelists.patch similarity index 100% rename from pkgs/applications/emulators/cemu/cmakelists.patch rename to pkgs/by-name/ce/cemu/cmakelists.patch diff --git a/pkgs/applications/emulators/cemu/default.nix b/pkgs/by-name/ce/cemu/package.nix similarity index 100% rename from pkgs/applications/emulators/cemu/default.nix rename to pkgs/by-name/ce/cemu/package.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 68731e7a7f64..f8d128afc879 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2595,8 +2595,6 @@ with pkgs; cdemu-daemon = callPackage ../applications/emulators/cdemu/daemon.nix { }; - cemu = callPackage ../applications/emulators/cemu { }; - cen64 = callPackage ../applications/emulators/cen64 { }; citations = callPackage ../applications/misc/citations { }; From ca1a2b752651aa11640b0c99f550a2dec9781587 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Mon, 17 Jun 2024 16:26:14 -0300 Subject: [PATCH 2/5] cemu: add AndersonTorres as maintainer --- pkgs/by-name/ce/cemu/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/by-name/ce/cemu/package.nix b/pkgs/by-name/ce/cemu/package.nix index c5860d3b0b26..0fe171070524 100644 --- a/pkgs/by-name/ce/cemu/package.nix +++ b/pkgs/by-name/ce/cemu/package.nix @@ -145,7 +145,7 @@ in stdenv.mkDerivation rec { homepage = "https://cemu.info"; license = licenses.mpl20; platforms = [ "x86_64-linux" ]; - maintainers = with maintainers; [ zhaofengli baduhai ]; + maintainers = with maintainers; [ zhaofengli baduhai AndersonTorres ]; mainProgram = "cemu"; }; } From 532f10715cd26c17aacdd37cec434f3b6b3f45f0 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Mon, 17 Jun 2024 16:29:02 -0300 Subject: [PATCH 3/5] cemu: refactor - finalAttrs - rename patch file - strictDeps - use lib.cmake* functions - ninja - get rid of nested with - fix description --- ... => 0000-spirv-tools-opt-cmakelists.patch} | 0 pkgs/by-name/ce/cemu/package.nix | 119 +++++++++--------- 2 files changed, 63 insertions(+), 56 deletions(-) rename pkgs/by-name/ce/cemu/{cmakelists.patch => 0000-spirv-tools-opt-cmakelists.patch} (100%) diff --git a/pkgs/by-name/ce/cemu/cmakelists.patch b/pkgs/by-name/ce/cemu/0000-spirv-tools-opt-cmakelists.patch similarity index 100% rename from pkgs/by-name/ce/cemu/cmakelists.patch rename to pkgs/by-name/ce/cemu/0000-spirv-tools-opt-cmakelists.patch diff --git a/pkgs/by-name/ce/cemu/package.nix b/pkgs/by-name/ce/cemu/package.nix index 0fe171070524..5424b1823b0f 100644 --- a/pkgs/by-name/ce/cemu/package.nix +++ b/pkgs/by-name/ce/cemu/package.nix @@ -1,34 +1,36 @@ -{ lib, stdenv, fetchFromGitHub -, addOpenGLRunpath -, wrapGAppsHook3 -, cmake -, glslang -, nasm -, pkg-config - -, SDL2 -, boost -, cubeb -, curl -, fmt_9 -, glm -, gtk3 -, hidapi -, imgui -, libpng -, libusb1 -, libzip -, libXrender -, pugixml -, rapidjson -, vulkan-headers -, wayland -, wxGTK32 -, zarchive -, gamemode -, vulkan-loader - -, nix-update-script +{ + lib, + SDL2, + addOpenGLRunpath, + boost, + cmake, + cubeb, + curl, + fetchFromGitHub, + fmt_9, + gamemode, + glm, + glslang, + gtk3, + hidapi, + imgui, + libXrender, + libpng, + libusb1, + libzip, + nasm, + ninja, + nix-update-script, + pkg-config, + pugixml, + rapidjson, + stdenv, + vulkan-headers, + vulkan-loader, + wayland, + wrapGAppsHook3, + wxGTK32, + zarchive, }: let @@ -43,15 +45,14 @@ let sha256 = "sha256-gf47uLeNiXQic43buB5ZnMqiotlUfIyAsP+3H7yJuFg="; }; }; - -in stdenv.mkDerivation rec { +in stdenv.mkDerivation (finalAttrs: { pname = "cemu"; version = "2.0-85"; src = fetchFromGitHub { owner = "cemu-project"; repo = "Cemu"; - rev = "v${version}"; + rev = "v${finalAttrs.version}"; hash = "sha256-uMVbKJhdHLLKsJnj7YFIG+S5pm7rSZfBSWebhTP01Y8="; }; @@ -59,15 +60,17 @@ in stdenv.mkDerivation rec { # glslangTargets want SPIRV-Tools-opt to be defined: # > The following imported targets are referenced, but are missing: # > SPIRV-Tools-opt - ./cmakelists.patch + ./0000-spirv-tools-opt-cmakelists.patch ]; nativeBuildInputs = [ + SDL2 addOpenGLRunpath wrapGAppsHook3 cmake glslang nasm + ninja pkg-config ]; @@ -94,24 +97,26 @@ in stdenv.mkDerivation rec { ]; cmakeFlags = [ - "-DCMAKE_C_FLAGS_RELEASE=-DNDEBUG" - "-DCMAKE_CXX_FLAGS_RELEASE=-DNDEBUG" - "-DENABLE_VCPKG=OFF" - "-DENABLE_FERAL_GAMEMODE=ON" + (lib.cmakeFeature "CMAKE_C_FLAGS_RELEASE" "-DNDEBUG") + (lib.cmakeFeature "CMAKE_CXX_FLAGS_RELEASE" "-DNDEBUG") + (lib.cmakeBool "ENABLE_VCPKG" false) + (lib.cmakeBool "ENABLE_FERAL_GAMEMODE" true) - # PORTABLE: - # "All data created and maintained by Cemu will be in the directory where the executable file is located" - "-DPORTABLE=OFF" + # PORTABLE: "All data created and maintained by Cemu will be in + # the directory where the executable file is located" + (lib.cmakeBool "PORTABLE" false) ]; - preConfigure = with lib; let - tag = last (splitString "-" version); + strictDeps = true; + + preConfigure = let + tag = lib.last (lib.splitString "-" finalAttrs.version); in '' rm -rf dependencies/imgui # cemu expects imgui source code, not just header files ln -s ${imgui'.src} dependencies/imgui - substituteInPlace src/Common/version.h --replace " (experimental)" "-${tag} (experimental)" - substituteInPlace dependencies/gamemode/lib/gamemode_client.h --replace "libgamemode.so.0" "${gamemode.lib}/lib/libgamemode.so.0" + substituteInPlace src/Common/version.h --replace-fail " (experimental)" "-${tag} (experimental)" + substituteInPlace dependencies/gamemode/lib/gamemode_client.h --replace-fail "libgamemode.so.0" "${gamemode.lib}/lib/libgamemode.so.0" ''; installPhase = '' @@ -138,14 +143,16 @@ in stdenv.mkDerivation rec { ) ''; - passthru.updateScript = nix-update-script { }; - - meta = with lib; { - description = "Cemu is a Wii U emulator"; - homepage = "https://cemu.info"; - license = licenses.mpl20; - platforms = [ "x86_64-linux" ]; - maintainers = with maintainers; [ zhaofengli baduhai AndersonTorres ]; - mainProgram = "cemu"; + passthru = { + updateScript = nix-update-script { }; }; -} + + meta = { + description = "Software to emulate Wii U games and applications on PC"; + homepage = "https://cemu.info"; + license = lib.licenses.mpl20; + mainProgram = "cemu"; + maintainers = with lib.maintainers; [ zhaofengli baduhai AndersonTorres ]; + platforms = [ "x86_64-linux" ]; + }; +}) From 5759f989b0a6cbfe6dedc30fe75fc68a8b0f2421 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Mon, 17 Jun 2024 16:59:40 -0300 Subject: [PATCH 4/5] cemu: add test.version --- pkgs/by-name/ce/cemu/package.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/by-name/ce/cemu/package.nix b/pkgs/by-name/ce/cemu/package.nix index 5424b1823b0f..77bf4fe9447d 100644 --- a/pkgs/by-name/ce/cemu/package.nix +++ b/pkgs/by-name/ce/cemu/package.nix @@ -25,6 +25,7 @@ pugixml, rapidjson, stdenv, + testers, vulkan-headers, vulkan-loader, wayland, @@ -145,6 +146,11 @@ in stdenv.mkDerivation (finalAttrs: { passthru = { updateScript = nix-update-script { }; + tests = { + version = testers.testVersion { + package = finalAttrs.finalPackage; + }; + }; }; meta = { From e3ff77236faf5b4da12e469acaca1d93823360f3 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Mon, 17 Jun 2024 17:00:00 -0300 Subject: [PATCH 5/5] cemu: 2.0-85 -> 2.0-86 --- pkgs/by-name/ce/cemu/package.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/ce/cemu/package.nix b/pkgs/by-name/ce/cemu/package.nix index 77bf4fe9447d..3a009ea0cb3b 100644 --- a/pkgs/by-name/ce/cemu/package.nix +++ b/pkgs/by-name/ce/cemu/package.nix @@ -48,13 +48,13 @@ let }; in stdenv.mkDerivation (finalAttrs: { pname = "cemu"; - version = "2.0-85"; + version = "2.0-86"; src = fetchFromGitHub { owner = "cemu-project"; repo = "Cemu"; rev = "v${finalAttrs.version}"; - hash = "sha256-uMVbKJhdHLLKsJnj7YFIG+S5pm7rSZfBSWebhTP01Y8="; + hash = "sha256-AS5Qo4J0U1MeTYWl4jiJMi879bhBuioU1BikxGKtUrE="; }; patches = [