From 1cd73eee4a263e6fe2961eaf5093a565e8f43647 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sat, 15 Mar 2025 19:56:52 +0100 Subject: [PATCH 1/6] dolphin-emu: format --- .../emulators/dolphin-emu/default.nix | 266 +++++++++--------- 1 file changed, 138 insertions(+), 128 deletions(-) diff --git a/pkgs/applications/emulators/dolphin-emu/default.nix b/pkgs/applications/emulators/dolphin-emu/default.nix index 26d84ff1da98..30fcee0993ae 100644 --- a/pkgs/applications/emulators/dolphin-emu/default.nix +++ b/pkgs/applications/emulators/dolphin-emu/default.nix @@ -1,56 +1,57 @@ -{ lib -, stdenv -, fetchFromGitHub -, cmake -, pkg-config -, wrapQtAppsHook -, alsa-lib -, bluez -, bzip2 -, cubeb -, curl -, enet -, ffmpeg -, fmt_10 -, gtest -, hidapi -, libevdev -, libGL -, libiconv -, libpulseaudio -, libspng -, libusb1 -, libXdmcp -, libXext -, libXrandr -, lz4 -, lzo -, mbedtls_2 -, miniupnpc -, minizip-ng -, openal -, pugixml -, qtbase -, qtsvg -, SDL2 -, sfml -, udev -, vulkan-loader -, xxHash -, xz +{ + lib, + stdenv, + fetchFromGitHub, + cmake, + pkg-config, + wrapQtAppsHook, + alsa-lib, + bluez, + bzip2, + cubeb, + curl, + enet, + ffmpeg, + fmt_10, + gtest, + hidapi, + libevdev, + libGL, + libiconv, + libpulseaudio, + libspng, + libusb1, + libXdmcp, + libXext, + libXrandr, + lz4, + lzo, + mbedtls_2, + miniupnpc, + minizip-ng, + openal, + pugixml, + qtbase, + qtsvg, + SDL2, + sfml, + udev, + vulkan-loader, + xxHash, + xz, # Used in passthru -, testers + testers, # Darwin-only dependencies -, CoreBluetooth -, ForceFeedback -, IOBluetooth -, IOKit -, moltenvk -, OpenGL -, VideoToolbox -, xcbuild + CoreBluetooth, + ForceFeedback, + IOBluetooth, + IOKit, + moltenvk, + OpenGL, + VideoToolbox, + xcbuild, }: stdenv.mkDerivation (finalAttrs: { @@ -67,79 +68,86 @@ stdenv.mkDerivation (finalAttrs: { strictDeps = true; - nativeBuildInputs = [ - cmake - pkg-config - wrapQtAppsHook - ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ - xcbuild # for plutil - ]; + nativeBuildInputs = + [ + cmake + pkg-config + wrapQtAppsHook + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + xcbuild # for plutil + ]; - buildInputs = [ - bzip2 - cubeb - curl - enet - ffmpeg - fmt_10 - gtest - hidapi - libiconv - libpulseaudio - libspng - libusb1 - libXdmcp - lz4 - lzo - mbedtls_2 - miniupnpc - minizip-ng - openal - pugixml - qtbase - qtsvg - SDL2 - sfml - xxHash - xz - # Causes linker errors with minizip-ng, prefer vendored. Possible reason why: https://github.com/dolphin-emu/dolphin/pull/12070#issuecomment-1677311838 - #zlib-ng - ] ++ lib.optionals stdenv.hostPlatform.isLinux [ - alsa-lib - bluez - libevdev - libGL - libXext - libXrandr - # FIXME: Vendored version is newer than mgba's stable release, remove the comment on next mgba's version - #mgba # Derivation doesn't support Darwin - udev - vulkan-loader - ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ - CoreBluetooth - ForceFeedback - IOBluetooth - IOKit - moltenvk - OpenGL - VideoToolbox - ]; + buildInputs = + [ + bzip2 + cubeb + curl + enet + ffmpeg + fmt_10 + gtest + hidapi + libiconv + libpulseaudio + libspng + libusb1 + libXdmcp + lz4 + lzo + mbedtls_2 + miniupnpc + minizip-ng + openal + pugixml + qtbase + qtsvg + SDL2 + sfml + xxHash + xz + # Causes linker errors with minizip-ng, prefer vendored. Possible reason why: https://github.com/dolphin-emu/dolphin/pull/12070#issuecomment-1677311838 + #zlib-ng + ] + ++ lib.optionals stdenv.hostPlatform.isLinux [ + alsa-lib + bluez + libevdev + libGL + libXext + libXrandr + # FIXME: Vendored version is newer than mgba's stable release, remove the comment on next mgba's version + #mgba # Derivation doesn't support Darwin + udev + vulkan-loader + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + CoreBluetooth + ForceFeedback + IOBluetooth + IOKit + moltenvk + OpenGL + VideoToolbox + ]; - cmakeFlags = [ - "-DDISTRIBUTOR=NixOS" - "-DDOLPHIN_WC_REVISION=${finalAttrs.src.rev}" - "-DDOLPHIN_WC_DESCRIBE=${finalAttrs.version}" - "-DDOLPHIN_WC_BRANCH=master" - ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ - "-DOSX_USE_DEFAULT_SEARCH_PATH=True" - "-DUSE_BUNDLED_MOLTENVK=OFF" - "-DMACOS_CODE_SIGNING=OFF" - # Bundles the application folder into a standalone executable, so we cannot devendor libraries - "-DSKIP_POSTPROCESS_BUNDLE=ON" - # Needs xcode so compilation fails with it enabled. We would want the version to be fixed anyways. - # Note: The updater isn't available on linux, so we don't need to disable it there. - "-DENABLE_AUTOUPDATE=OFF" - ]; + cmakeFlags = + [ + "-DDISTRIBUTOR=NixOS" + "-DDOLPHIN_WC_REVISION=${finalAttrs.src.rev}" + "-DDOLPHIN_WC_DESCRIBE=${finalAttrs.version}" + "-DDOLPHIN_WC_BRANCH=master" + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + "-DOSX_USE_DEFAULT_SEARCH_PATH=True" + "-DUSE_BUNDLED_MOLTENVK=OFF" + "-DMACOS_CODE_SIGNING=OFF" + # Bundles the application folder into a standalone executable, so we cannot devendor libraries + "-DSKIP_POSTPROCESS_BUNDLE=ON" + # Needs xcode so compilation fails with it enabled. We would want the version to be fixed anyways. + # Note: The updater isn't available on linux, so we don't need to disable it there. + "-DENABLE_AUTOUPDATE=OFF" + ]; qtWrapperArgs = lib.optionals stdenv.hostPlatform.isLinux [ "--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ vulkan-loader ]}" @@ -148,14 +156,16 @@ stdenv.mkDerivation (finalAttrs: { "--set QT_QPA_PLATFORM xcb" ]; - postInstall = lib.optionalString stdenv.hostPlatform.isLinux '' - install -D $src/Data/51-usb-device.rules $out/etc/udev/rules.d/51-usb-device.rules - '' + lib.optionalString stdenv.hostPlatform.isDarwin '' - # Only gets installed automatically if the standalone executable is used - mkdir -p $out/Applications - cp -r ./Binaries/Dolphin.app $out/Applications - ln -s $out/Applications/Dolphin.app/Contents/MacOS/Dolphin $out/bin - ''; + postInstall = + lib.optionalString stdenv.hostPlatform.isLinux '' + install -D $src/Data/51-usb-device.rules $out/etc/udev/rules.d/51-usb-device.rules + '' + + lib.optionalString stdenv.hostPlatform.isDarwin '' + # Only gets installed automatically if the standalone executable is used + mkdir -p $out/Applications + cp -r ./Binaries/Dolphin.app $out/Applications + ln -s $out/Applications/Dolphin.app/Contents/MacOS/Dolphin $out/bin + ''; passthru = { tests.version = testers.testVersion { From 6b444b590fa7e553839bf7942ea66b3370f975a5 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sat, 15 Mar 2025 19:58:47 +0100 Subject: [PATCH 2/6] dolphin-emu: move to by-name --- .../do/dolphin-emu/package.nix} | 22 ++++--------------- pkgs/top-level/all-packages.nix | 5 ----- 2 files changed, 4 insertions(+), 23 deletions(-) rename pkgs/{applications/emulators/dolphin-emu/default.nix => by-name/do/dolphin-emu/package.nix} (93%) diff --git a/pkgs/applications/emulators/dolphin-emu/default.nix b/pkgs/by-name/do/dolphin-emu/package.nix similarity index 93% rename from pkgs/applications/emulators/dolphin-emu/default.nix rename to pkgs/by-name/do/dolphin-emu/package.nix index 30fcee0993ae..b9f393823c4f 100644 --- a/pkgs/applications/emulators/dolphin-emu/default.nix +++ b/pkgs/by-name/do/dolphin-emu/package.nix @@ -4,7 +4,6 @@ fetchFromGitHub, cmake, pkg-config, - wrapQtAppsHook, alsa-lib, bluez, bzip2, @@ -31,8 +30,7 @@ minizip-ng, openal, pugixml, - qtbase, - qtsvg, + qt6, SDL2, sfml, udev, @@ -44,13 +42,7 @@ testers, # Darwin-only dependencies - CoreBluetooth, - ForceFeedback, - IOBluetooth, - IOKit, moltenvk, - OpenGL, - VideoToolbox, xcbuild, }: @@ -72,7 +64,7 @@ stdenv.mkDerivation (finalAttrs: { [ cmake pkg-config - wrapQtAppsHook + qt6.wrapQtAppsHook ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ xcbuild # for plutil @@ -100,8 +92,8 @@ stdenv.mkDerivation (finalAttrs: { minizip-ng openal pugixml - qtbase - qtsvg + qt6.qtbase + qt6.qtsvg SDL2 sfml xxHash @@ -122,13 +114,7 @@ stdenv.mkDerivation (finalAttrs: { vulkan-loader ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ - CoreBluetooth - ForceFeedback - IOBluetooth - IOKit moltenvk - OpenGL - VideoToolbox ]; cmakeFlags = diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 16fd58b44885..2d0d0322a884 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1437,11 +1437,6 @@ with pkgs; ### APPLICATIONS/EMULATORS/DOLPHIN-EMU - dolphin-emu = qt6Packages.callPackage ../applications/emulators/dolphin-emu { - stdenv = if stdenv.hostPlatform.isDarwin then overrideSDK stdenv "11.0" else stdenv; - inherit (darwin.apple_sdk_11_0.frameworks) CoreBluetooth ForceFeedback IOBluetooth IOKit OpenGL VideoToolbox; - }; - dolphin-emu-primehack = qt6.callPackage ../applications/emulators/dolphin-emu/primehack.nix { inherit (darwin.apple_sdk.frameworks) CoreBluetooth ForceFeedback IOKit OpenGL; }; From 34034b75f1a96f5bf902df0a5f224044e35ec161 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sat, 15 Mar 2025 20:11:19 +0100 Subject: [PATCH 3/6] dolphin-emu: cleanup, modernize --- pkgs/by-name/do/dolphin-emu/package.nix | 88 ++++++++++++++----------- 1 file changed, 50 insertions(+), 38 deletions(-) diff --git a/pkgs/by-name/do/dolphin-emu/package.nix b/pkgs/by-name/do/dolphin-emu/package.nix index b9f393823c4f..22e4d03fcd5d 100644 --- a/pkgs/by-name/do/dolphin-emu/package.nix +++ b/pkgs/by-name/do/dolphin-emu/package.nix @@ -2,10 +2,15 @@ lib, stdenv, fetchFromGitHub, + + # nativeBuildInputs cmake, pkg-config, - alsa-lib, - bluez, + qt6, + # darwin-only + xcbuild, + + # buildInputs bzip2, cubeb, curl, @@ -14,15 +19,10 @@ fmt_10, gtest, hidapi, - libevdev, - libGL, - libiconv, + libXdmcp, libpulseaudio, libspng, libusb1, - libXdmcp, - libXext, - libXrandr, lz4, lzo, mbedtls_2, @@ -30,20 +30,25 @@ minizip-ng, openal, pugixml, - qt6, SDL2, sfml, - udev, - vulkan-loader, xxHash, xz, - - # Used in passthru - testers, - - # Darwin-only dependencies + # linux-only + alsa-lib, + bluez, + libGL, + libXext, + libXrandr, + libevdev, + udev, + vulkan-loader, + # darwin-only moltenvk, - xcbuild, + + # passthru + testers, + nix-update-script, }: stdenv.mkDerivation (finalAttrs: { @@ -54,8 +59,8 @@ stdenv.mkDerivation (finalAttrs: { owner = "dolphin-emu"; repo = "dolphin"; tag = finalAttrs.version; - hash = "sha256-oqJKXFcsFgoYjUqdk3Z/CIFhOa8w0drcF4JwtHRI1Hs="; fetchSubmodules = true; + hash = "sha256-oqJKXFcsFgoYjUqdk3Z/CIFhOa8w0drcF4JwtHRI1Hs="; }; strictDeps = true; @@ -80,11 +85,10 @@ stdenv.mkDerivation (finalAttrs: { fmt_10 gtest hidapi - libiconv + libXdmcp libpulseaudio libspng libusb1 - libXdmcp lz4 lzo mbedtls_2 @@ -104,10 +108,10 @@ stdenv.mkDerivation (finalAttrs: { ++ lib.optionals stdenv.hostPlatform.isLinux [ alsa-lib bluez - libevdev libGL libXext libXrandr + libevdev # FIXME: Vendored version is newer than mgba's stable release, remove the comment on next mgba's version #mgba # Derivation doesn't support Darwin udev @@ -119,20 +123,20 @@ stdenv.mkDerivation (finalAttrs: { cmakeFlags = [ - "-DDISTRIBUTOR=NixOS" - "-DDOLPHIN_WC_REVISION=${finalAttrs.src.rev}" - "-DDOLPHIN_WC_DESCRIBE=${finalAttrs.version}" - "-DDOLPHIN_WC_BRANCH=master" + (lib.cmakeFeature "DISTRIBUTOR" "NixOS") + (lib.cmakeFeature "DOLPHIN_WC_REVISION" finalAttrs.src.rev) + (lib.cmakeFeature "DOLPHIN_WC_DESCRIBE" finalAttrs.version) + (lib.cmakeFeature "DOLPHIN_WC_BRANCH" "master") ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ - "-DOSX_USE_DEFAULT_SEARCH_PATH=True" - "-DUSE_BUNDLED_MOLTENVK=OFF" - "-DMACOS_CODE_SIGNING=OFF" + (lib.cmakeBool "OSX_USE_DEFAULT_SEARCH_PATH" true) + (lib.cmakeBool "USE_BUNDLED_MOLTENVK" false) + (lib.cmakeBool "MACOS_CODE_SIGNING" false) # Bundles the application folder into a standalone executable, so we cannot devendor libraries - "-DSKIP_POSTPROCESS_BUNDLE=ON" + (lib.cmakeBool "SKIP_POSTPROCESS_BUNDLE" true) # Needs xcode so compilation fails with it enabled. We would want the version to be fixed anyways. # Note: The updater isn't available on linux, so we don't need to disable it there. - "-DENABLE_AUTOUPDATE=OFF" + (lib.cmakeBool "ENABLE_AUTOUPDATE" false) ]; qtWrapperArgs = lib.optionals stdenv.hostPlatform.isLinux [ @@ -154,20 +158,28 @@ stdenv.mkDerivation (finalAttrs: { ''; passthru = { - tests.version = testers.testVersion { - package = finalAttrs.finalPackage; - command = "dolphin-emu-nogui --version"; - inherit (finalAttrs) version; + tests = { + version = testers.testVersion { + package = finalAttrs.finalPackage; + command = "dolphin-emu-nogui --version"; + inherit (finalAttrs) version; + }; + }; + updateScript = nix-update-script { + extraArgs = [ + "--version-regex" + "([0-9]+)" + ]; }; }; - meta = with lib; { + meta = { homepage = "https://dolphin-emu.org"; description = "Gamecube/Wii/Triforce emulator for x86_64 and ARMv8"; mainProgram = if stdenv.hostPlatform.isDarwin then "Dolphin" else "dolphin-emu"; branch = "master"; - license = licenses.gpl2Plus; - platforms = platforms.unix; - maintainers = with maintainers; [ pbsds ]; + license = lib.licenses.gpl2Plus; + platforms = lib.platforms.unix; + maintainers = with lib.maintainers; [ pbsds ]; }; }) From cf0b43ee7a417f2b27cf618f973ac3df149ab09e Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sat, 15 Mar 2025 20:30:40 +0100 Subject: [PATCH 4/6] dolphin-emu-primehack: move to by-name --- .../do/dolphin-emu-primehack/package.nix} | 20 ++++--------------- pkgs/top-level/all-packages.nix | 8 -------- 2 files changed, 4 insertions(+), 24 deletions(-) rename pkgs/{applications/emulators/dolphin-emu/primehack.nix => by-name/do/dolphin-emu-primehack/package.nix} (91%) diff --git a/pkgs/applications/emulators/dolphin-emu/primehack.nix b/pkgs/by-name/do/dolphin-emu-primehack/package.nix similarity index 91% rename from pkgs/applications/emulators/dolphin-emu/primehack.nix rename to pkgs/by-name/do/dolphin-emu-primehack/package.nix index 66200efda720..54735ae7dbbe 100644 --- a/pkgs/applications/emulators/dolphin-emu/primehack.nix +++ b/pkgs/by-name/do/dolphin-emu-primehack/package.nix @@ -4,9 +4,7 @@ fetchFromGitHub, pkg-config, cmake, - wrapQtAppsHook, - qtbase, - qtsvg, + qt6, bluez, ffmpeg, libao, @@ -40,10 +38,6 @@ libpulseaudio, # - Inputs used for Darwin - CoreBluetooth, - ForceFeedback, - IOKit, - OpenGL, libpng, hidapi, }: @@ -63,7 +57,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ pkg-config cmake - ] ++ lib.optional stdenv.hostPlatform.isLinux wrapQtAppsHook; + ] ++ lib.optional stdenv.hostPlatform.isLinux qt6.wrapQtAppsHook; buildInputs = [ @@ -95,8 +89,8 @@ stdenv.mkDerivation rec { sfml fmt xz - qtbase - qtsvg + qt6.qtbase + qt6.qtsvg ] ++ lib.optionals stdenv.hostPlatform.isLinux [ bluez @@ -104,12 +98,6 @@ stdenv.mkDerivation rec { libevdev alsa-lib vulkan-loader - ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ - CoreBluetooth - OpenGL - ForceFeedback - IOKit ]; cmakeFlags = diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2d0d0322a884..be3503ff7b60 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1433,14 +1433,6 @@ with pkgs; zsnes = pkgsi686Linux.callPackage ../applications/emulators/zsnes { }; zsnes2 = pkgsi686Linux.callPackage ../applications/emulators/zsnes/2.x.nix { }; - ### APPLICATIONS/EMULATORS/BSNES - - ### APPLICATIONS/EMULATORS/DOLPHIN-EMU - - dolphin-emu-primehack = qt6.callPackage ../applications/emulators/dolphin-emu/primehack.nix { - inherit (darwin.apple_sdk.frameworks) CoreBluetooth ForceFeedback IOKit OpenGL; - }; - ### APPLICATIONS/EMULATORS/RETROARCH libretro = recurseIntoAttrs (callPackage ../applications/emulators/libretro { }); From 5d899ccf1686316a1d6e7d22aa1f6d080c469003 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sat, 15 Mar 2025 20:35:04 +0100 Subject: [PATCH 5/6] dolphin-emu-primehack: cleanup, modernize --- .../do/dolphin-emu-primehack/package.nix | 167 ++++++++++-------- 1 file changed, 97 insertions(+), 70 deletions(-) diff --git a/pkgs/by-name/do/dolphin-emu-primehack/package.nix b/pkgs/by-name/do/dolphin-emu-primehack/package.nix index 54735ae7dbbe..fc70ffade761 100644 --- a/pkgs/by-name/do/dolphin-emu-primehack/package.nix +++ b/pkgs/by-name/do/dolphin-emu-primehack/package.nix @@ -2,111 +2,124 @@ lib, stdenv, fetchFromGitHub, + + # nativeBuildInputs pkg-config, cmake, qt6, - bluez, + + # buildInputs + curl, + enet, ffmpeg, - libao, - libGLU, - libGL, - pcre, + fmt, gettext, - libXrandr, - libusb1, - libpthreadstubs, - libXext, - libXxf86vm, - libXinerama, + libGL, + libGLU, libSM, libXdmcp, - readline, - openal, - udev, - libevdev, - portaudio, - curl, - alsa-lib, - miniupnpc, - enet, - mbedtls_2, - soundtouch, - sfml, - fmt, - xz, - vulkan-loader, + libXext, + libXinerama, + libXrandr, + libXxf86vm, + libao, + libpthreadstubs, libpulseaudio, + libusb1, + mbedtls_2, + miniupnpc, + openal, + pcre, + portaudio, + readline, + sfml, + soundtouch, + xz, + # linux-only + alsa-lib, + bluez, + libevdev, + udev, + vulkan-loader, # - Inputs used for Darwin libpng, hidapi, + + # passthru + testers, + nix-update-script, }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "dolphin-emu-primehack"; version = "1.0.7a"; src = fetchFromGitHub { owner = "shiiion"; repo = "dolphin"; - rev = version; - hash = "sha256-vuTSXQHnR4HxAGGiPg5tUzfiXROU3+E9kyjH+T6zVmc="; + tag = finalAttrs.version; fetchSubmodules = true; + hash = "sha256-vuTSXQHnR4HxAGGiPg5tUzfiXROU3+E9kyjH+T6zVmc="; }; - nativeBuildInputs = [ - pkg-config - cmake - ] ++ lib.optional stdenv.hostPlatform.isLinux qt6.wrapQtAppsHook; + nativeBuildInputs = + [ + pkg-config + cmake + ] + ++ lib.optionals stdenv.hostPlatform.isLinux [ + qt6.wrapQtAppsHook + ]; buildInputs = [ curl + enet ffmpeg - libao - libGLU - libGL - pcre + fmt gettext + hidapi + libGL + libGLU + libSM + libXdmcp + libXext + libXinerama + libXrandr + libXxf86vm + libao + libpng libpthreadstubs libpulseaudio - libXrandr - libXext - libXxf86vm - libXinerama - libSM - readline - openal - libXdmcp - portaudio libusb1 - libpng - hidapi - miniupnpc - enet mbedtls_2 - soundtouch - sfml - fmt - xz + miniupnpc + openal + pcre + portaudio qt6.qtbase qt6.qtsvg + readline + sfml + soundtouch + xz ] ++ lib.optionals stdenv.hostPlatform.isLinux [ - bluez - udev - libevdev alsa-lib + bluez + libevdev + udev vulkan-loader ]; cmakeFlags = [ - "-DUSE_SHARED_ENET=ON" - "-DENABLE_LTO=ON" + (lib.cmakeBool "USE_SHARED_ENET" true) + (lib.cmakeBool "ENABLE_LTO" true) ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ - "-DOSX_USE_DEFAULT_SEARCH_PATH=True" + (lib.cmakeBool "OSX_USE_DEFAULT_SEARCH_PATH" true) ]; qtWrapperArgs = lib.optionals stdenv.hostPlatform.isLinux [ @@ -119,11 +132,13 @@ stdenv.mkDerivation rec { # - Allow Dolphin to use nix-provided libraries instead of building them postPatch = '' - substituteInPlace CMakeLists.txt --replace 'DISTRIBUTOR "None"' 'DISTRIBUTOR "NixOS"' + substituteInPlace CMakeLists.txt \ + --replace-fail 'DISTRIBUTOR "None"' 'DISTRIBUTOR "NixOS"' '' + lib.optionalString stdenv.hostPlatform.isDarwin '' - substituteInPlace CMakeLists.txt --replace 'if(NOT APPLE)' 'if(true)' - substituteInPlace CMakeLists.txt --replace 'if(LIBUSB_FOUND AND NOT APPLE)' 'if(LIBUSB_FOUND)' + substituteInPlace CMakeLists.txt \ + --replace-fail 'if(NOT APPLE)' 'if(true)' \ + --replace-fail 'if(LIBUSB_FOUND AND NOT APPLE)' 'if(LIBUSB_FOUND)' ''; postInstall = @@ -132,19 +147,31 @@ stdenv.mkDerivation rec { mv $out/bin/dolphin-emu-nogui $out/bin/dolphin-emu-primehack-nogui mv $out/share/applications/dolphin-emu.desktop $out/share/applications/dolphin-emu-primehack.desktop mv $out/share/icons/hicolor/256x256/apps/dolphin-emu.png $out/share/icons/hicolor/256x256/apps/dolphin-emu-primehack.png - substituteInPlace $out/share/applications/dolphin-emu-primehack.desktop --replace 'dolphin-emu' 'dolphin-emu-primehack' - substituteInPlace $out/share/applications/dolphin-emu-primehack.desktop --replace 'Dolphin Emulator' 'PrimeHack' + substituteInPlace $out/share/applications/dolphin-emu-primehack.desktop \ + --replace-fail 'dolphin-emu' 'dolphin-emu-primehack' \ + --replace-fail 'Dolphin Emulator' 'PrimeHack' '' + lib.optionalString stdenv.hostPlatform.isLinux '' install -D $src/Data/51-usb-device.rules $out/etc/udev/rules.d/51-usb-device.rules ''; - meta = with lib; { + passthru = { + tests = { + version = testers.testVersion { + package = finalAttrs.finalPackage; + command = "dolphin-emu-primehack-nogui --version"; + version = "v${finalAttrs.version}"; + }; + }; + updateScript = nix-update-script { }; + }; + + meta = { homepage = "https://github.com/shiiion/dolphin"; description = "Gamecube/Wii/Triforce emulator for x86_64 and ARMv8"; - license = licenses.gpl2Plus; - maintainers = with maintainers; [ Madouura ]; + license = lib.licenses.gpl2Plus; + maintainers = with lib.maintainers; [ Madouura ]; broken = stdenv.hostPlatform.isDarwin; - platforms = platforms.unix; + platforms = lib.platforms.unix; }; -} +}) From 5fe07e65806091015aeecbb576f8234d01de0b7d Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sat, 15 Mar 2025 20:36:16 +0100 Subject: [PATCH 6/6] dolphin-emu-primehack: do not add darwin-only dependencies when building for linux --- pkgs/by-name/do/dolphin-emu-primehack/package.nix | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pkgs/by-name/do/dolphin-emu-primehack/package.nix b/pkgs/by-name/do/dolphin-emu-primehack/package.nix index fc70ffade761..cddbe407e301 100644 --- a/pkgs/by-name/do/dolphin-emu-primehack/package.nix +++ b/pkgs/by-name/do/dolphin-emu-primehack/package.nix @@ -41,10 +41,9 @@ libevdev, udev, vulkan-loader, - - # - Inputs used for Darwin - libpng, + # darwin-only hidapi, + libpng, # passthru testers, @@ -79,7 +78,6 @@ stdenv.mkDerivation (finalAttrs: { ffmpeg fmt gettext - hidapi libGL libGLU libSM @@ -89,7 +87,6 @@ stdenv.mkDerivation (finalAttrs: { libXrandr libXxf86vm libao - libpng libpthreadstubs libpulseaudio libusb1 @@ -111,6 +108,10 @@ stdenv.mkDerivation (finalAttrs: { libevdev udev vulkan-loader + ] + ++ lib.optionals stdenv.hostPlatform.isLinux [ + hidapi + libpng ]; cmakeFlags =