2022-05-17 22:01:41 +00:00
|
|
|
{ pname
|
|
|
|
, version
|
|
|
|
, src
|
|
|
|
, branch
|
|
|
|
, compat-list
|
|
|
|
|
|
|
|
, lib
|
|
|
|
, stdenv
|
|
|
|
, cmake
|
2023-08-07 11:42:39 +00:00
|
|
|
, boost
|
2022-05-17 22:01:41 +00:00
|
|
|
, pkg-config
|
2023-10-29 11:11:28 +00:00
|
|
|
, catch2_3
|
|
|
|
, cpp-jwt
|
|
|
|
, cryptopp
|
|
|
|
, enet
|
|
|
|
, ffmpeg
|
|
|
|
, fmt
|
2023-12-05 08:37:52 +00:00
|
|
|
, gamemode
|
2023-08-07 11:42:39 +00:00
|
|
|
, glslang
|
2023-10-29 11:11:28 +00:00
|
|
|
, httplib
|
|
|
|
, inih
|
|
|
|
, libusb1
|
|
|
|
, nlohmann_json
|
|
|
|
, openal
|
|
|
|
, openssl
|
|
|
|
, SDL2
|
|
|
|
, soundtouch
|
|
|
|
, spirv-tools
|
2022-05-17 22:01:41 +00:00
|
|
|
, zstd
|
2023-10-29 11:11:28 +00:00
|
|
|
, vulkan-headers
|
|
|
|
, vulkan-loader
|
|
|
|
, enableSdl2Frontend ? true
|
|
|
|
, enableQt ? true, qtbase, qtmultimedia, qtwayland, wrapQtAppsHook
|
2022-05-17 22:01:41 +00:00
|
|
|
, enableQtTranslation ? enableQt, qttools
|
|
|
|
, enableWebService ? true
|
2022-11-08 18:37:34 +00:00
|
|
|
, enableCubeb ? true, cubeb
|
2022-05-17 22:01:41 +00:00
|
|
|
, useDiscordRichPresence ? true, rapidjson
|
|
|
|
}:
|
2023-10-29 11:11:28 +00:00
|
|
|
stdenv.mkDerivation {
|
2022-05-17 22:01:41 +00:00
|
|
|
inherit pname version src;
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
pkg-config
|
2023-10-29 11:11:28 +00:00
|
|
|
ffmpeg
|
|
|
|
glslang
|
2022-05-17 22:01:41 +00:00
|
|
|
] ++ lib.optionals enableQt [ wrapQtAppsHook ];
|
|
|
|
|
|
|
|
buildInputs = [
|
2023-08-07 11:42:39 +00:00
|
|
|
boost
|
2023-10-29 11:11:28 +00:00
|
|
|
catch2_3
|
|
|
|
cpp-jwt
|
|
|
|
cryptopp
|
|
|
|
# intentionally omitted: dynarmic - prefer vendored version for compatibility
|
|
|
|
enet
|
|
|
|
fmt
|
|
|
|
httplib
|
|
|
|
inih
|
2022-05-17 22:01:41 +00:00
|
|
|
libusb1
|
2023-10-29 11:11:28 +00:00
|
|
|
nlohmann_json
|
|
|
|
openal
|
|
|
|
openssl
|
|
|
|
SDL2
|
|
|
|
soundtouch
|
|
|
|
spirv-tools
|
|
|
|
vulkan-headers
|
|
|
|
# intentionally omitted: xbyak - prefer vendored version for compatibility
|
|
|
|
zstd
|
|
|
|
] ++ lib.optionals enableQt [ qtbase qtmultimedia qtwayland ]
|
2022-05-17 22:01:41 +00:00
|
|
|
++ lib.optional enableQtTranslation qttools
|
2023-10-29 11:11:28 +00:00
|
|
|
++ lib.optional enableCubeb cubeb
|
|
|
|
++ lib.optional useDiscordRichPresence rapidjson;
|
2022-05-17 22:01:41 +00:00
|
|
|
|
|
|
|
cmakeFlags = [
|
2023-10-29 11:11:28 +00:00
|
|
|
"-DUSE_SYSTEM_LIBS=ON"
|
|
|
|
|
|
|
|
"-DDISABLE_SYSTEM_DYNARMIC=ON"
|
|
|
|
"-DDISABLE_SYSTEM_GLSLANG=ON" # The following imported targets are referenced, but are missing: SPIRV-Tools-opt
|
|
|
|
"-DDISABLE_SYSTEM_LODEPNG=ON" # Not packaged in nixpkgs
|
|
|
|
"-DDISABLE_SYSTEM_VMA=ON"
|
|
|
|
"-DDISABLE_SYSTEM_XBYAK=ON"
|
2022-05-17 22:01:41 +00:00
|
|
|
|
2023-10-29 11:11:28 +00:00
|
|
|
# We don't want to bother upstream with potentially outdated compat reports
|
2022-05-17 22:01:41 +00:00
|
|
|
"-DCITRA_ENABLE_COMPATIBILITY_REPORTING=ON"
|
|
|
|
"-DENABLE_COMPATIBILITY_LIST_DOWNLOAD=OFF" # We provide this deterministically
|
2023-10-29 11:11:28 +00:00
|
|
|
] ++ lib.optional (!enableSdl2Frontend) "-DENABLE_SDL2_FRONTEND=OFF"
|
2022-05-17 22:01:41 +00:00
|
|
|
++ lib.optional (!enableQt) "-DENABLE_QT=OFF"
|
|
|
|
++ lib.optional enableQtTranslation "-DENABLE_QT_TRANSLATION=ON"
|
|
|
|
++ lib.optional (!enableWebService) "-DENABLE_WEB_SERVICE=OFF"
|
|
|
|
++ lib.optional (!enableCubeb) "-DENABLE_CUBEB=OFF"
|
2023-10-29 11:11:28 +00:00
|
|
|
++ lib.optional useDiscordRichPresence "-DUSE_DISCORD_PRESENCE=ON";
|
2022-05-17 22:01:41 +00:00
|
|
|
|
2023-10-29 11:11:28 +00:00
|
|
|
# causes redefinition of _FORTIFY_SOURCE
|
|
|
|
hardeningDisable = [ "fortify3" ];
|
|
|
|
|
|
|
|
postPatch = let
|
2023-08-07 11:42:39 +00:00
|
|
|
branchCaptialized = (lib.toUpper (lib.substring 0 1 branch) + lib.substring 1 (-1) branch);
|
|
|
|
in ''
|
2023-04-05 23:44:58 +00:00
|
|
|
# Fix file not found when looking in var/empty instead of opt
|
|
|
|
mkdir externals/dynarmic/src/dynarmic/ir/var
|
|
|
|
ln -s ../opt externals/dynarmic/src/dynarmic/ir/var/empty
|
|
|
|
|
2022-05-17 22:01:41 +00:00
|
|
|
# Prep compatibilitylist
|
|
|
|
ln -s ${compat-list} ./dist/compatibility_list/compatibility_list.json
|
|
|
|
|
|
|
|
# We already know the submodules are present
|
|
|
|
substituteInPlace CMakeLists.txt \
|
|
|
|
--replace "check_submodules_present()" ""
|
|
|
|
|
2023-08-07 11:42:39 +00:00
|
|
|
# Add versions
|
|
|
|
echo 'set(BUILD_FULLNAME "${branchCaptialized} ${version}")' >> CMakeModules/GenerateBuildInfo.cmake
|
2023-12-05 08:37:52 +00:00
|
|
|
|
|
|
|
# Add gamemode
|
|
|
|
substituteInPlace externals/gamemode/include/gamemode_client.h --replace "libgamemode.so.0" "${lib.getLib gamemode}/lib/libgamemode.so.0"
|
2022-05-17 22:01:41 +00:00
|
|
|
'';
|
|
|
|
|
2023-10-29 11:11:28 +00:00
|
|
|
postInstall = let
|
|
|
|
libs = lib.makeLibraryPath [ vulkan-loader ];
|
|
|
|
in lib.optionalString enableSdl2Frontend ''
|
2022-05-17 22:01:41 +00:00
|
|
|
wrapProgram "$out/bin/citra" \
|
2023-10-29 11:11:28 +00:00
|
|
|
--prefix LD_LIBRARY_PATH : ${libs}
|
|
|
|
'' + lib.optionalString enableQt ''
|
|
|
|
qtWrapperArgs+=(
|
|
|
|
--prefix LD_LIBRARY_PATH : ${libs}
|
|
|
|
)
|
2022-05-17 22:01:41 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
2022-05-29 09:37:28 +00:00
|
|
|
broken = (stdenv.isLinux && stdenv.isAarch64);
|
2022-05-17 22:01:41 +00:00
|
|
|
homepage = "https://citra-emu.org";
|
2023-12-05 08:37:52 +00:00
|
|
|
description = "The ${branch} branch of an open-source emulator for the Nintendo 3DS";
|
2022-05-17 22:01:41 +00:00
|
|
|
longDescription = ''
|
|
|
|
A Nintendo 3DS Emulator written in C++
|
|
|
|
Using the nightly branch is recommended for general usage.
|
|
|
|
Using the canary branch is recommended if you would like to try out
|
|
|
|
experimental features, with a cost of stability.
|
|
|
|
'';
|
|
|
|
mainProgram = if enableQt then "citra-qt" else "citra";
|
|
|
|
platforms = platforms.linux;
|
|
|
|
license = licenses.gpl2Plus;
|
|
|
|
maintainers = with maintainers; [
|
|
|
|
abbradar
|
|
|
|
ashley
|
|
|
|
ivar
|
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|