nixpkgs/pkgs/by-name/li/lime3ds/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

159 lines
4.0 KiB
Nix
Raw Normal View History

2024-05-22 07:04:55 +00:00
{ alsa-lib
, boost
, catch2_3
, cmake
, cryptopp
, cpp-jwt
, doxygen
, enet
, fetchzip
, fetchurl
, fmt
, ffmpeg-headless
, gamemode
, httplib
, inih
, lib
, libGL
, libjack2
, libpulseaudio
, libunwind
, libusb1
, nlohmann_json
, openal
, openssl
, pipewire
, pkg-config
, portaudio
, sndio
, spirv-tools
, soundtouch
, stdenv
, vulkan-headers
, vulkan-loader
, xorg
, zstd
, enableSdl2Frontend ? true , SDL2
, enableQt ? true , kdePackages
, enableQtTranslations ? enableQt
, enableCubeb ? true , cubeb
, useDiscordRichPresence ? false , rapidjson
}: let
2024-07-15 13:22:19 +00:00
inherit (lib) optional optionals cmakeBool optionalString getLib makeLibraryPath;
2024-05-22 07:04:55 +00:00
compat-list = fetchurl {
name = "lime3ds-compat-list";
2024-07-15 13:22:19 +00:00
url = "https://raw.githubusercontent.com/Lime3DS/compatibility-list/fa9d49d22e698df2f238e53f2b34acda08b947f6/compatibility_list.json";
hash = "sha256-dNZuU8uFXJ5gw/rmtF6bAjtrvVBXP8aUNXVdBY1dT34=";
2024-05-22 07:04:55 +00:00
};
in stdenv.mkDerivation (finalAttrs: {
pname = "lime3ds";
2024-07-20 22:18:13 +00:00
version = "2116";
2024-05-22 07:04:55 +00:00
src = fetchzip {
url = "https://github.com/Lime3DS/Lime3DS/releases/download/${finalAttrs.version}/lime3ds-unified-source-${finalAttrs.version}.tar.xz";
2024-07-20 22:18:13 +00:00
hash = "sha256-ff4An+ZdxlY4H90Yep4lpKROOMEkDijb3dVFIgSPvWQ=";
2024-05-22 07:04:55 +00:00
};
nativeBuildInputs = [
cmake
doxygen
pkg-config
] ++ lib.optionals enableQt [kdePackages.wrapQtAppsHook];
buildInputs = [
alsa-lib
boost
catch2_3
cryptopp
cpp-jwt
enet
fmt
ffmpeg-headless
httplib
inih
libGL
libjack2
libpulseaudio
libunwind
libusb1
nlohmann_json
openal
openssl
pipewire
portaudio
SDL2
soundtouch
sndio
spirv-tools
vulkan-headers
xorg.libX11
xorg.libXext
zstd
2024-07-15 13:22:19 +00:00
] ++ optionals enableQt (with kdePackages; [
2024-05-22 07:04:55 +00:00
qtbase
qtmultimedia
qttools
qtwayland
2024-07-15 13:22:19 +00:00
]) ++ optionals enableQtTranslations [kdePackages.qttools]
++ optionals enableCubeb [cubeb]
++ optional useDiscordRichPresence rapidjson;
2024-05-22 07:04:55 +00:00
postPatch = ''
# 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
# Prep compatibilitylist
rm ./dist/compatibility_list/compatibility_list.json
ln -s ${compat-list} ./dist/compatibility_list/compatibility_list.json
# We already know the submodules are present
substituteInPlace CMakeLists.txt \
--replace-fail "check_submodules_present()" ""
# Add gamemode
substituteInPlace externals/gamemode/include/gamemode_client.h \
2024-07-15 13:22:19 +00:00
--replace-fail "libgamemode.so.0" "${getLib gamemode}/lib/libgamemode.so.0"
2024-05-22 07:04:55 +00:00
'';
postInstall = let
2024-07-15 13:22:19 +00:00
libs = makeLibraryPath [ vulkan-loader ];
in optionalString enableSdl2Frontend ''
2024-05-22 07:04:55 +00:00
for binfile in lime3ds-gui lime3ds-cli lime3ds-room
do
wrapProgram "$out/bin/$binfile" \
--prefix LD_LIBRARY_PATH : ${libs}
2024-07-15 13:22:19 +00:00
'' + optionalString enableQt ''
2024-05-22 07:04:55 +00:00
qtWrapperArgs+=(
--prefix LD_LIBRARY_PATH : ${libs}
)
done
'';
2024-07-15 13:22:19 +00:00
cmakeFlags = [
2024-05-22 07:04:55 +00:00
(cmakeBool "CITRA_USE_PRECOMPILED_HEADERS" false)
(cmakeBool "ENABLE_QT_TRANSLATION" enableQtTranslations)
(cmakeBool "USE_SYSTEM_LIBS" true)
(cmakeBool "DISABLE_SYSTEM_DYNARMIC" true)
(cmakeBool "DISABLE_SYSTEM_GLSLANG" true)
(cmakeBool "DISABLE_SYSTEM_LODEPNG" true)
(cmakeBool "DISABLE_SYSTEM_VMA" true)
(cmakeBool "DISABLE_SYSTEM_XBYAK" true)
(cmakeBool "CITRA_ENABLE_COMPATIBILITY_REPORTING" true)
(cmakeBool "ENABLE_COMPATIBILITY_LIST_DOWNLOAD" false)
(cmakeBool "ENABLE_SDL2_FRONTEND" enableSdl2Frontend)
(cmakeBool "ENABLE_CUBEB" enableCubeb)
(cmakeBool "USE_DISCORD_PRESENCE" useDiscordRichPresence)
];
2024-07-15 13:22:19 +00:00
meta = {
2024-05-22 07:04:55 +00:00
description = "A Nintendo 3DS emulator based on Citra";
homepage = "https://github.com/Lime3DS/Lime3DS";
2024-07-15 13:22:19 +00:00
license = lib.licenses.gpl2Only;
maintainers = with lib.maintainers; [ arthsmn ];
2024-05-22 07:04:55 +00:00
mainProgram = if enableQt then "lime3ds-gui" else "lime3ds-cli";
2024-07-15 13:22:19 +00:00
platforms = lib.platforms.linux;
2024-05-22 07:04:55 +00:00
};
})