2022-09-30 11:47:45 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, pkg-config
|
|
|
|
, cmake
|
|
|
|
, wrapQtAppsHook
|
|
|
|
, qtbase
|
|
|
|
, bluez
|
|
|
|
, ffmpeg
|
|
|
|
, libGL
|
|
|
|
, libXrandr
|
|
|
|
, libusb1
|
2022-11-21 17:40:18 +00:00
|
|
|
, libXdmcp
|
2022-09-30 11:47:45 +00:00
|
|
|
, libXext
|
|
|
|
, openal
|
|
|
|
, udev
|
|
|
|
, libevdev
|
2022-11-21 17:40:18 +00:00
|
|
|
, cubeb
|
2022-09-30 11:47:45 +00:00
|
|
|
, curl
|
|
|
|
, alsa-lib
|
|
|
|
, miniupnpc
|
|
|
|
, enet
|
|
|
|
, mbedtls
|
|
|
|
, soundtouch
|
|
|
|
, sfml
|
|
|
|
, xz
|
|
|
|
, hidapi
|
|
|
|
, fmt_8
|
|
|
|
, vulkan-loader
|
|
|
|
, libpulseaudio
|
|
|
|
, bzip2
|
|
|
|
, libiconv
|
|
|
|
, pugixml
|
|
|
|
, xxHash
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
# Used in passthru
|
|
|
|
, testers
|
|
|
|
, dolphin-emu-beta
|
|
|
|
, writeShellScript
|
|
|
|
, common-updater-scripts
|
|
|
|
, jq
|
|
|
|
|
|
|
|
# Darwin-only dependencies
|
|
|
|
, CoreBluetooth
|
|
|
|
, ForceFeedback
|
|
|
|
, IOKit
|
|
|
|
, VideoToolbox
|
|
|
|
, OpenGL
|
|
|
|
, libpng
|
|
|
|
, moltenvk
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "dolphin-emu";
|
2022-09-22 12:36:57 +00:00
|
|
|
version = "5.0-17269";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "dolphin-emu";
|
|
|
|
repo = "dolphin";
|
2022-09-22 12:36:57 +00:00
|
|
|
rev = "48c9c224cf9f82f0f9f2690b7cc6283d7448480c";
|
|
|
|
sha256 = "sha256-WC3jukRygZigLx987CzRmOmJ7DeS1atXrMzU98sRzEg=";
|
2021-10-17 02:12:59 +00:00
|
|
|
fetchSubmodules = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
patches = [
|
|
|
|
# On x86_64-darwin CMake reportedly does not work without this in some cases.
|
|
|
|
# See https://github.com/NixOS/nixpkgs/pull/190373#issuecomment-1241310765
|
|
|
|
./minizip-external-missing-include.patch
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
pkg-config
|
|
|
|
wrapQtAppsHook
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
2022-11-21 17:40:18 +00:00
|
|
|
cubeb
|
2022-09-30 11:47:45 +00:00
|
|
|
curl
|
|
|
|
ffmpeg
|
|
|
|
pugixml
|
|
|
|
xxHash
|
|
|
|
libGL
|
|
|
|
libpulseaudio
|
|
|
|
openal
|
|
|
|
libusb1
|
|
|
|
libiconv
|
|
|
|
libpng
|
2022-11-21 17:40:18 +00:00
|
|
|
libXdmcp
|
2022-09-30 11:47:45 +00:00
|
|
|
hidapi
|
|
|
|
miniupnpc
|
|
|
|
enet
|
|
|
|
mbedtls
|
|
|
|
soundtouch
|
|
|
|
sfml
|
|
|
|
xz
|
2020-04-24 23:36:52 +00:00
|
|
|
qtbase
|
2022-09-30 11:47:45 +00:00
|
|
|
fmt_8
|
|
|
|
bzip2
|
2020-04-24 23:36:52 +00:00
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
2022-09-30 11:47:45 +00:00
|
|
|
libXrandr
|
|
|
|
libXext
|
|
|
|
bluez
|
|
|
|
udev
|
|
|
|
libevdev
|
|
|
|
alsa-lib
|
|
|
|
vulkan-loader
|
2020-04-24 23:36:52 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
2022-09-30 11:47:45 +00:00
|
|
|
CoreBluetooth
|
|
|
|
OpenGL
|
|
|
|
ForceFeedback
|
|
|
|
IOKit
|
|
|
|
VideoToolbox
|
|
|
|
moltenvk
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
cmakeFlags = [
|
2022-09-30 11:47:45 +00:00
|
|
|
"-DDISTRIBUTOR=NixOS"
|
2020-04-24 23:36:52 +00:00
|
|
|
"-DUSE_SHARED_ENET=ON"
|
|
|
|
"-DDOLPHIN_WC_REVISION=${src.rev}"
|
|
|
|
"-DDOLPHIN_WC_DESCRIBE=${version}"
|
|
|
|
"-DDOLPHIN_WC_BRANCH=master"
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
"-DOSX_USE_DEFAULT_SEARCH_PATH=True"
|
2022-09-30 11:47:45 +00:00
|
|
|
"-DUSE_BUNDLED_MOLTENVK=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 dont need to disable it there.
|
|
|
|
"-DENABLE_AUTOUPDATE=OFF"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
qtWrapperArgs = lib.optionals stdenv.isLinux [
|
2022-11-21 17:40:18 +00:00
|
|
|
"--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [vulkan-loader]}"
|
2021-12-06 16:07:01 +00:00
|
|
|
# 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
|
|
|
];
|
|
|
|
|
2022-09-30 11:47:45 +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-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
postInstall = lib.optionalString stdenv.hostPlatform.isLinux ''
|
2020-12-07 07:45:13 +00:00
|
|
|
install -D $src/Data/51-usb-device.rules $out/etc/udev/rules.d/51-usb-device.rules
|
2022-09-30 11:47:45 +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-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
passthru = {
|
|
|
|
tests.version = testers.testVersion {
|
|
|
|
package = dolphin-emu-beta;
|
|
|
|
command = "dolphin-emu-nogui --version";
|
|
|
|
};
|
2021-12-06 16:07:01 +00:00
|
|
|
|
2022-09-30 11:47:45 +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-beta "$version" --rev="$rev"
|
|
|
|
'';
|
|
|
|
};
|
2021-12-06 16:07:01 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://dolphin-emu.org";
|
|
|
|
description = "Gamecube/Wii/Triforce emulator for x86_64 and ARMv8";
|
2022-11-21 17:40:18 +00:00
|
|
|
mainProgram = if stdenv.hostPlatform.isDarwin then "Dolphin" else "dolphin-emu";
|
2020-04-24 23:36:52 +00:00
|
|
|
branch = "master";
|
2022-09-30 11:47:45 +00:00
|
|
|
license = licenses.gpl2Plus;
|
2022-06-16 17:23:12 +00:00
|
|
|
platforms = platforms.unix;
|
2022-09-30 11:47:45 +00:00
|
|
|
maintainers = with maintainers; [
|
|
|
|
MP2E
|
|
|
|
ashkitten
|
|
|
|
xfix
|
|
|
|
ivar
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|