nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 boost,
3 catch2_3,
4 cmake,
5 cryptopp,
6 cpp-jwt,
7 doxygen,
8 dynarmic,
9 enet,
10 fetchpatch,
11 fetchzip,
12 fmt,
13 ffmpeg_6-headless,
14 glslang,
15 httplib,
16 inih,
17 lib,
18 libGL,
19 libunwind,
20 libusb1,
21 moltenvk,
22 nlohmann_json,
23 openal,
24 openssl,
25 pipewire,
26 pkg-config,
27 portaudio,
28 robin-map,
29 SDL2,
30 spirv-tools,
31 soundtouch,
32 stdenv,
33 vulkan-headers,
34 xbyak,
35 xorg,
36 zstd,
37 enableQtTranslations ? true,
38 qt6,
39 enableCubeb ? true,
40 cubeb,
41 useDiscordRichPresence ? true,
42 rapidjson,
43 enableSSE42 ? true, # Disable if your hardware doesn't support SSE 4.2 (mainly CPUs before 2011)
44 gamemode,
45 enableGamemode ? lib.meta.availableOn stdenv.hostPlatform gamemode,
46}:
47let
48 inherit (lib)
49 optionals
50 optionalString
51 cmakeBool
52 getLib
53 ;
54in
55stdenv.mkDerivation (finalAttrs: {
56 pname = "azahar";
57 version = "2122.1";
58
59 src = fetchzip {
60 url = "https://github.com/azahar-emu/azahar/releases/download/${finalAttrs.version}/azahar-unified-source-${finalAttrs.version}.tar.xz";
61 hash = "sha256-RQ8dgD09cWyVWGSLzHz1oJOKia1OKr2jHqYwKaVGfxE=";
62 };
63
64 nativeBuildInputs = [
65 cmake
66 doxygen
67 pkg-config
68 qt6.wrapQtAppsHook
69 ];
70
71 buildInputs = [
72 boost
73 catch2_3
74 cryptopp
75 cpp-jwt
76 dynarmic
77 enet
78 fmt
79 ffmpeg_6-headless
80 glslang
81 httplib
82 inih
83 libGL
84 libunwind
85 libusb1
86 nlohmann_json
87 openal
88 openssl
89 portaudio
90 robin-map
91 qt6.qtbase
92 qt6.qtmultimedia
93 qt6.qttools
94 soundtouch
95 SDL2
96 spirv-tools
97 vulkan-headers
98 xbyak
99 zstd
100 ]
101 ++ optionals enableQtTranslations [ qt6.qttools ]
102 ++ optionals enableCubeb [ cubeb ]
103 ++ optionals useDiscordRichPresence [ rapidjson ]
104 ++ optionals stdenv.hostPlatform.isLinux [
105 pipewire
106 qt6.qtwayland
107 xorg.libX11
108 xorg.libXext
109 ]
110 ++ optionals stdenv.hostPlatform.isDarwin [
111 moltenvk
112 ];
113
114 patches = [
115 # Fix boost errors
116 (fetchpatch {
117 url = "https://raw.githubusercontent.com/Tatsh/tatsh-overlay/fa2f92b888f8c0aab70414ca560b823ffb33b122/games-emulation/lime3ds/files/lime3ds-0002-boost-fix.patch";
118 hash = "sha256-XJogqvQE7I5lVHtvQja0woVlO40blhFOqnoYftIQwJs=";
119 })
120
121 # Fix boost 1.87
122 (fetchpatch {
123 url = "https://raw.githubusercontent.com/Tatsh/tatsh-overlay/5c4497d9b67fa6f2fa327b2f2ce4cb5be8c9f2f7/games-emulation/lime3ds/files/lime3ds-0003-boost-1.87-fixes.patch";
124 hash = "sha256-mwfI7fTx9aWF/EjMW3bxoz++A+6ONbNA70tT5nkhDUU=";
125 })
126
127 # https://github.com/azahar-emu/azahar/pull/1165
128 ./update-cmake-lists.patch
129 ];
130
131 postPatch = ''
132 # We already know the submodules are present
133 substituteInPlace CMakeLists.txt \
134 --replace-fail "check_submodules_present()" ""
135 ''
136 # Add gamemode
137 + optionalString enableGamemode ''
138 substituteInPlace externals/gamemode/include/gamemode_client.h \
139 --replace-fail "libgamemode.so.0" "${getLib gamemode}/lib/libgamemode.so.0"
140 '';
141
142 cmakeFlags = [
143 (cmakeBool "USE_SYSTEM_LIBS" true)
144 (cmakeBool "DISABLE_SYSTEM_LODEPNG" true)
145 (cmakeBool "DISABLE_SYSTEM_VMA" true)
146 (cmakeBool "ENABLE_QT_TRANSLATION" enableQtTranslations)
147 (cmakeBool "ENABLE_CUBEB" enableCubeb)
148 (cmakeBool "USE_DISCORD_PRESENCE" useDiscordRichPresence)
149 (cmakeBool "ENABLE_SSE42" enableSSE42)
150 ];
151
152 meta = {
153 description = "Open-source 3DS emulator project based on Citra";
154 homepage = "https://github.com/azahar-emu/azahar";
155 license = lib.licenses.gpl2Only;
156 maintainers = with lib.maintainers; [
157 arthsmn
158 marcin-serwin
159 ];
160 mainProgram = "azahar";
161 platforms = with lib.platforms; linux ++ darwin;
162 };
163})