2023-02-16 17:41:37 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
2020-04-24 23:36:52 +00:00
|
|
|
, cmake
|
2023-02-16 17:41:37 +00:00
|
|
|
, pkg-config
|
|
|
|
, wrapQtAppsHook
|
|
|
|
, alsa-lib
|
2020-04-24 23:36:52 +00:00
|
|
|
, bluez
|
2023-02-16 17:41:37 +00:00
|
|
|
, bzip2
|
|
|
|
, cubeb
|
|
|
|
, curl
|
|
|
|
, enet
|
2021-02-13 14:23:35 +00:00
|
|
|
, ffmpeg
|
2024-01-25 14:12:00 +00:00
|
|
|
, fmt_10
|
2023-10-09 19:29:22 +00:00
|
|
|
, gtest
|
2023-02-16 17:41:37 +00:00
|
|
|
, hidapi
|
|
|
|
, libevdev
|
2020-04-24 23:36:52 +00:00
|
|
|
, libGL
|
2023-02-16 17:41:37 +00:00
|
|
|
, libiconv
|
|
|
|
, libpulseaudio
|
|
|
|
, libspng
|
2020-04-24 23:36:52 +00:00
|
|
|
, libusb1
|
2023-02-16 17:41:37 +00:00
|
|
|
, libXdmcp
|
|
|
|
, libXext
|
|
|
|
, libXrandr
|
2024-01-25 14:12:00 +00:00
|
|
|
, lz4
|
2023-10-09 19:29:22 +00:00
|
|
|
, lzo
|
2022-12-17 10:02:37 +00:00
|
|
|
, mbedtls_2
|
2023-02-16 17:41:37 +00:00
|
|
|
, miniupnpc
|
|
|
|
, minizip-ng
|
|
|
|
, openal
|
|
|
|
, pugixml
|
|
|
|
, qtbase
|
2023-10-09 19:29:22 +00:00
|
|
|
, qtsvg
|
2020-04-24 23:36:52 +00:00
|
|
|
, sfml
|
2023-02-16 17:41:37 +00:00
|
|
|
, udev
|
|
|
|
, vulkan-loader
|
|
|
|
, xxHash
|
|
|
|
, xz
|
|
|
|
|
|
|
|
# Used in passthru
|
|
|
|
, common-updater-scripts
|
|
|
|
, dolphin-emu
|
|
|
|
, jq
|
|
|
|
, testers
|
|
|
|
, writeShellScript
|
|
|
|
|
|
|
|
# Darwin-only dependencies
|
|
|
|
, CoreBluetooth
|
|
|
|
, ForceFeedback
|
2023-04-29 16:46:19 +00:00
|
|
|
, IOBluetooth
|
2023-02-16 17:41:37 +00:00
|
|
|
, IOKit
|
|
|
|
, moltenvk
|
|
|
|
, OpenGL
|
|
|
|
, VideoToolbox
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "dolphin-emu";
|
2024-01-25 14:12:00 +00:00
|
|
|
version = "5.0-20347";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "dolphin-emu";
|
|
|
|
repo = "dolphin";
|
2024-01-25 14:12:00 +00:00
|
|
|
rev = "dc0814ae4622313d513468bdc377ee9c031de199";
|
|
|
|
hash = "sha256-s3mGwXkgdoLLfPEUVyjaqXb+a5KPKC3dhHIyKC2BF1w=";
|
2023-02-16 17:41:37 +00:00
|
|
|
fetchSubmodules = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
patches = [
|
|
|
|
# Remove when merged https://github.com/dolphin-emu/dolphin/pull/12070
|
|
|
|
./find-minizip-ng.patch
|
|
|
|
];
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
strictDeps = true;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
nativeBuildInputs = [
|
2023-07-15 17:15:38 +00:00
|
|
|
stdenv.cc
|
2020-04-24 23:36:52 +00:00
|
|
|
cmake
|
2023-02-16 17:41:37 +00:00
|
|
|
pkg-config
|
|
|
|
wrapQtAppsHook
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [
|
|
|
|
CoreBluetooth
|
|
|
|
ForceFeedback
|
|
|
|
IOBluetooth
|
|
|
|
IOKit
|
|
|
|
moltenvk
|
|
|
|
OpenGL
|
|
|
|
VideoToolbox
|
|
|
|
] ++ [
|
2023-02-16 17:41:37 +00:00
|
|
|
bzip2
|
|
|
|
cubeb
|
|
|
|
curl
|
|
|
|
enet
|
2021-02-13 14:23:35 +00:00
|
|
|
ffmpeg
|
2024-01-25 14:12:00 +00:00
|
|
|
fmt_10
|
2023-10-09 19:29:22 +00:00
|
|
|
gtest
|
2023-02-16 17:41:37 +00:00
|
|
|
hidapi
|
|
|
|
libiconv
|
2020-04-24 23:36:52 +00:00
|
|
|
libpulseaudio
|
2023-02-16 17:41:37 +00:00
|
|
|
libspng
|
2020-04-24 23:36:52 +00:00
|
|
|
libusb1
|
2023-02-16 17:41:37 +00:00
|
|
|
libXdmcp
|
2024-01-25 14:12:00 +00:00
|
|
|
lz4
|
2023-10-09 19:29:22 +00:00
|
|
|
lzo
|
2022-12-17 10:02:37 +00:00
|
|
|
mbedtls_2
|
2023-02-16 17:41:37 +00:00
|
|
|
miniupnpc
|
|
|
|
minizip-ng
|
|
|
|
openal
|
|
|
|
pugixml
|
|
|
|
qtbase
|
2023-10-09 19:29:22 +00:00
|
|
|
qtsvg
|
2020-04-24 23:36:52 +00:00
|
|
|
sfml
|
2023-02-16 17:41:37 +00:00
|
|
|
xxHash
|
2023-10-09 19:29:22 +00:00
|
|
|
xz # LibLZMA
|
2023-02-16 17:41:37 +00:00
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
alsa-lib
|
|
|
|
bluez
|
|
|
|
libevdev
|
2023-07-15 17:15:38 +00:00
|
|
|
libGL
|
2023-02-16 17:41:37 +00:00
|
|
|
libXext
|
|
|
|
libXrandr
|
2023-10-09 19:29:22 +00:00
|
|
|
# FIXME: Vendored version is newer than mgba's stable release, remove the comment on next mgba's version
|
2023-07-15 17:15:38 +00:00
|
|
|
#mgba # Derivation doesn't support Darwin
|
2023-02-16 17:41:37 +00:00
|
|
|
udev
|
|
|
|
vulkan-loader
|
|
|
|
];
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DDISTRIBUTOR=NixOS"
|
|
|
|
"-DDOLPHIN_WC_REVISION=${src.rev}"
|
|
|
|
"-DDOLPHIN_WC_DESCRIBE=${version}"
|
|
|
|
"-DDOLPHIN_WC_BRANCH=master"
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
"-DOSX_USE_DEFAULT_SEARCH_PATH=True"
|
|
|
|
"-DUSE_BUNDLED_MOLTENVK=OFF"
|
2023-07-15 17:15:38 +00:00
|
|
|
"-DMACOS_CODE_SIGNING=OFF"
|
2023-02-16 17:41:37 +00:00
|
|
|
# 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.
|
2023-07-15 17:15:38 +00:00
|
|
|
# Note: The updater isn't available on linux, so we don't need to disable it there.
|
2023-02-16 17:41:37 +00:00
|
|
|
"-DENABLE_AUTOUPDATE=OFF"
|
|
|
|
];
|
|
|
|
|
|
|
|
qtWrapperArgs = lib.optionals stdenv.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"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2023-02-16 17:41:37 +00:00
|
|
|
# Use nix-provided libraries instead of submodules
|
|
|
|
postPatch = lib.optionalString stdenv.isDarwin ''
|
|
|
|
substituteInPlace CMakeLists.txt \
|
|
|
|
--replace "if(NOT APPLE)" "if(true)" \
|
|
|
|
--replace "if(LIBUSB_FOUND AND NOT APPLE)" "if(LIBUSB_FOUND)"
|
|
|
|
'';
|
|
|
|
|
2020-12-07 07:45:13 +00:00
|
|
|
postInstall = lib.optionalString stdenv.hostPlatform.isLinux ''
|
|
|
|
install -D $src/Data/51-usb-device.rules $out/etc/udev/rules.d/51-usb-device.rules
|
2023-02-16 17:41:37 +00:00
|
|
|
'' + 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
|
2020-12-07 07:45:13 +00:00
|
|
|
'';
|
|
|
|
|
2023-02-16 17:41:37 +00:00
|
|
|
passthru = {
|
|
|
|
tests.version = testers.testVersion {
|
|
|
|
package = dolphin-emu;
|
|
|
|
command = "dolphin-emu-nogui --version";
|
2023-11-16 04:20:00 +00:00
|
|
|
version = if stdenv.hostPlatform.isDarwin then "Dolphin 5.0" else version;
|
2023-02-16 17:41:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
updateScript = writeShellScript "dolphin-update-script" ''
|
|
|
|
set -eou pipefail
|
|
|
|
export PATH=${lib.makeBinPath [ curl jq common-updater-scripts ]}
|
|
|
|
|
|
|
|
json="$(curl -s https://dolphin-emu.org/update/latest/beta)"
|
|
|
|
version="$(jq -r '.shortrev' <<< "$json")"
|
|
|
|
rev="$(jq -r '.hash' <<< "$json")"
|
|
|
|
update-source-version dolphin-emu "$version" --rev="$rev"
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
2023-02-16 17:41:37 +00:00
|
|
|
homepage = "https://dolphin-emu.org";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Gamecube/Wii/Triforce emulator for x86_64 and ARMv8";
|
2023-02-16 17:41:37 +00:00
|
|
|
mainProgram = if stdenv.hostPlatform.isDarwin then "Dolphin" else "dolphin-emu";
|
|
|
|
branch = "master";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.gpl2Plus;
|
2023-02-16 17:41:37 +00:00
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [
|
|
|
|
MP2E
|
|
|
|
ashkitten
|
|
|
|
xfix
|
|
|
|
ivar
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|