dolphin-emu[-primehack]: cleanup, move to by-name (#390208)

This commit is contained in:
Peder Bergebakken Sundt
2025-03-20 02:11:16 +01:00
committed by GitHub
4 changed files with 286 additions and 275 deletions
@@ -1,177 +0,0 @@
{ 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
# Darwin-only dependencies
, CoreBluetooth
, ForceFeedback
, IOBluetooth
, IOKit
, moltenvk
, OpenGL
, VideoToolbox
, xcbuild
}:
stdenv.mkDerivation (finalAttrs: {
pname = "dolphin-emu";
version = "2503";
src = fetchFromGitHub {
owner = "dolphin-emu";
repo = "dolphin";
tag = finalAttrs.version;
hash = "sha256-oqJKXFcsFgoYjUqdk3Z/CIFhOa8w0drcF4JwtHRI1Hs=";
fetchSubmodules = true;
};
strictDeps = true;
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
];
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 ]}"
# https://bugs.dolphin-emu.org/issues/11807
# The .desktop file should already set this, but Dolphin may be launched in other ways
"--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
'';
passthru = {
tests.version = testers.testVersion {
package = finalAttrs.finalPackage;
command = "dolphin-emu-nogui --version";
inherit (finalAttrs) version;
};
};
meta = with lib; {
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 ];
};
})
@@ -2,123 +2,125 @@
lib,
stdenv,
fetchFromGitHub,
# nativeBuildInputs
pkg-config,
cmake,
wrapQtAppsHook,
qtbase,
qtsvg,
bluez,
qt6,
# 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,
# - Inputs used for Darwin
CoreBluetooth,
ForceFeedback,
IOKit,
OpenGL,
libpng,
libusb1,
mbedtls_2,
miniupnpc,
openal,
pcre,
portaudio,
readline,
sfml,
soundtouch,
xz,
# linux-only
alsa-lib,
bluez,
libevdev,
udev,
vulkan-loader,
# darwin-only
hidapi,
libpng,
# 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 wrapQtAppsHook;
nativeBuildInputs =
[
pkg-config
cmake
]
++ lib.optionals stdenv.hostPlatform.isLinux [
qt6.wrapQtAppsHook
];
buildInputs =
[
curl
enet
ffmpeg
libao
libGLU
libGL
pcre
fmt
gettext
libGL
libGLU
libSM
libXdmcp
libXext
libXinerama
libXrandr
libXxf86vm
libao
libpthreadstubs
libpulseaudio
libXrandr
libXext
libXxf86vm
libXinerama
libSM
readline
openal
libXdmcp
portaudio
libusb1
libpng
hidapi
miniupnpc
enet
mbedtls_2
soundtouch
miniupnpc
openal
pcre
portaudio
qt6.qtbase
qt6.qtsvg
readline
sfml
fmt
soundtouch
xz
qtbase
qtsvg
]
++ lib.optionals stdenv.hostPlatform.isLinux [
bluez
udev
libevdev
alsa-lib
bluez
libevdev
udev
vulkan-loader
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
CoreBluetooth
OpenGL
ForceFeedback
IOKit
++ lib.optionals stdenv.hostPlatform.isLinux [
hidapi
libpng
];
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 [
@@ -131,11 +133,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 =
@@ -144,19 +148,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;
};
}
})
+185
View File
@@ -0,0 +1,185 @@
{
lib,
stdenv,
fetchFromGitHub,
# nativeBuildInputs
cmake,
pkg-config,
qt6,
# darwin-only
xcbuild,
# buildInputs
bzip2,
cubeb,
curl,
enet,
ffmpeg,
fmt_10,
gtest,
hidapi,
libXdmcp,
libpulseaudio,
libspng,
libusb1,
lz4,
lzo,
mbedtls_2,
miniupnpc,
minizip-ng,
openal,
pugixml,
SDL2,
sfml,
xxHash,
xz,
# linux-only
alsa-lib,
bluez,
libGL,
libXext,
libXrandr,
libevdev,
udev,
vulkan-loader,
# darwin-only
moltenvk,
# passthru
testers,
nix-update-script,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "dolphin-emu";
version = "2503";
src = fetchFromGitHub {
owner = "dolphin-emu";
repo = "dolphin";
tag = finalAttrs.version;
fetchSubmodules = true;
hash = "sha256-oqJKXFcsFgoYjUqdk3Z/CIFhOa8w0drcF4JwtHRI1Hs=";
};
strictDeps = true;
nativeBuildInputs =
[
cmake
pkg-config
qt6.wrapQtAppsHook
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
xcbuild # for plutil
];
buildInputs =
[
bzip2
cubeb
curl
enet
ffmpeg
fmt_10
gtest
hidapi
libXdmcp
libpulseaudio
libspng
libusb1
lz4
lzo
mbedtls_2
miniupnpc
minizip-ng
openal
pugixml
qt6.qtbase
qt6.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
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
vulkan-loader
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
moltenvk
];
cmakeFlags =
[
(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 [
(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
(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.
(lib.cmakeBool "ENABLE_AUTOUPDATE" false)
];
qtWrapperArgs = lib.optionals stdenv.hostPlatform.isLinux [
"--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ vulkan-loader ]}"
# https://bugs.dolphin-emu.org/issues/11807
# The .desktop file should already set this, but Dolphin may be launched in other ways
"--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
'';
passthru = {
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 = {
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 = lib.licenses.gpl2Plus;
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ pbsds ];
};
})
-13
View File
@@ -1433,19 +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 = 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;
};
### APPLICATIONS/EMULATORS/RETROARCH
libretro = recurseIntoAttrs (callPackage ../applications/emulators/libretro { });