1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
{
lib,
SDL2,
addDriverRunpath,
boost,
cmake,
cubeb,
curl,
fetchFromGitHub,
fmt_9,
gamemode,
glm,
glslang,
gtk3,
hidapi,
imgui,
libXrender,
libpng,
libusb1,
libzip,
nasm,
ninja,
nix-update-script,
pkg-config,
pugixml,
rapidjson,
stdenv,
testers,
vulkan-headers,
vulkan-loader,
wayland,
wrapGAppsHook3,
wxGTK32,
zarchive,
}:
let
# cemu doesn't build with imgui 1.90.2 or newer:
# error: 'struct ImGuiIO' has no member named 'ImeWindowHandle'
imgui' = imgui.overrideAttrs rec {
version = "1.90.1";
src = fetchFromGitHub {
owner = "ocornut";
repo = "imgui";
rev = "v${version}";
sha256 = "sha256-gf47uLeNiXQic43buB5ZnMqiotlUfIyAsP+3H7yJuFg=";
};
};
in stdenv.mkDerivation (finalAttrs: {
pname = "cemu";
version = "2.0-88";
src = fetchFromGitHub {
owner = "cemu-project";
repo = "Cemu";
rev = "v${finalAttrs.version}";
hash = "sha256-ZXJrxfTgwDmHUk3UqA4H4MSEvNNq9lXHXxf9rgWqkro=";
};
patches = [
# glslangTargets want SPIRV-Tools-opt to be defined:
# > The following imported targets are referenced, but are missing:
# > SPIRV-Tools-opt
./0000-spirv-tools-opt-cmakelists.patch
];
nativeBuildInputs = [
SDL2
addDriverRunpath
wrapGAppsHook3
cmake
glslang
nasm
ninja
pkg-config
];
buildInputs = [
SDL2
boost
cubeb
curl
fmt_9
glm
gtk3
hidapi
imgui'
libpng
libusb1
libzip
libXrender
pugixml
rapidjson
vulkan-headers
wayland
wxGTK32
zarchive
];
cmakeFlags = [
(lib.cmakeFeature "CMAKE_C_FLAGS_RELEASE" "-DNDEBUG")
(lib.cmakeFeature "CMAKE_CXX_FLAGS_RELEASE" "-DNDEBUG")
(lib.cmakeBool "ENABLE_VCPKG" false)
(lib.cmakeBool "ENABLE_FERAL_GAMEMODE" true)
# PORTABLE: "All data created and maintained by Cemu will be in
# the directory where the executable file is located"
(lib.cmakeBool "PORTABLE" false)
];
strictDeps = true;
preConfigure = let
tag = lib.last (lib.splitString "-" finalAttrs.version);
in ''
rm -rf dependencies/imgui
# cemu expects imgui source code, not just header files
ln -s ${imgui'.src} dependencies/imgui
substituteInPlace src/Common/version.h --replace-fail " (experimental)" "-${tag} (experimental)"
substituteInPlace dependencies/gamemode/lib/gamemode_client.h --replace-fail "libgamemode.so.0" "${gamemode.lib}/lib/libgamemode.so.0"
'';
installPhase = ''
runHook preInstall
install -Dm755 ../bin/Cemu_release $out/bin/Cemu
ln -s $out/bin/Cemu $out/bin/cemu
mkdir -p $out/share/applications
substitute ../dist/linux/info.cemu.Cemu.desktop $out/share/applications/info.cemu.Cemu.desktop \
--replace "Exec=Cemu" "Exec=$out/bin/Cemu"
install -Dm644 ../dist/linux/info.cemu.Cemu.metainfo.xml -t $out/share/metainfo
install -Dm644 ../src/resource/logo_icon.png $out/share/icons/hicolor/128x128/apps/info.cemu.Cemu.png
runHook postInstall
'';
preFixup = let
libs = [ vulkan-loader ] ++ cubeb.passthru.backendLibs;
in ''
gappsWrapperArgs+=(
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath libs}"
)
'';
passthru = {
updateScript = nix-update-script { };
tests = {
version = testers.testVersion {
package = finalAttrs.finalPackage;
};
};
};
meta = {
description = "Software to emulate Wii U games and applications on PC";
homepage = "https://cemu.info";
license = lib.licenses.mpl20;
mainProgram = "cemu";
maintainers = with lib.maintainers; [ zhaofengli baduhai AndersonTorres ];
platforms = [ "x86_64-linux" ];
};
})
|