nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildDotnetModule,
4 cctools,
5 darwin,
6 dotnetCorePackages,
7 fetchFromGitLab,
8 libX11,
9 libgdiplus,
10 moltenvk,
11 ffmpeg,
12 openal,
13 libsoundio,
14 sndio,
15 stdenv,
16 pulseaudio,
17 vulkan-loader,
18 glew,
19 libGL,
20 libICE,
21 libSM,
22 libXcursor,
23 libXext,
24 libXi,
25 libXrandr,
26 udev,
27 SDL2,
28 SDL2_mixer,
29 gtk3,
30 wrapGAppsHook3,
31}:
32
33buildDotnetModule rec {
34 pname = "ryubing";
35 version = "1.3.3";
36
37 src = fetchFromGitLab {
38 domain = "git.ryujinx.app";
39 owner = "Ryubing";
40 repo = "Ryujinx";
41 tag = version;
42 hash = "sha256-LhQaXxmj5HIgfmrsDN8GhhVXlXHpDO2Q8JtNLaCq0mk=";
43 };
44
45 nativeBuildInputs =
46 lib.optional stdenv.hostPlatform.isLinux [
47 wrapGAppsHook3
48 ]
49 ++ lib.optional stdenv.hostPlatform.isDarwin [
50 cctools
51 darwin.sigtool
52 ];
53
54 enableParallelBuilding = false;
55
56 dotnet-sdk = dotnetCorePackages.sdk_9_0;
57 dotnet-runtime = dotnetCorePackages.runtime_9_0;
58
59 nugetDeps = ./deps.json;
60
61 runtimeDeps = [
62 libX11
63 libgdiplus
64 SDL2_mixer
65 openal
66 libsoundio
67 sndio
68 vulkan-loader
69 ffmpeg
70
71 # Avalonia UI
72 glew
73 libICE
74 libSM
75 libXcursor
76 libXext
77 libXi
78 libXrandr
79 gtk3
80
81 # Headless executable
82 libGL
83 SDL2
84 ]
85 ++ lib.optional (!stdenv.hostPlatform.isDarwin) [
86 udev
87 pulseaudio
88 ]
89 ++ lib.optional stdenv.hostPlatform.isDarwin [ moltenvk ];
90
91 projectFile = "Ryujinx.sln";
92 testProjectFile = "src/Ryujinx.Tests/Ryujinx.Tests.csproj";
93
94 # Tests on Darwin currently fail because of Ryujinx.Tests.Unicorn
95 doCheck = !stdenv.hostPlatform.isDarwin;
96
97 dotnetFlags = [
98 "/p:ExtraDefineConstants=DISABLE_UPDATER%2CFORCE_EXTERNAL_BASE_DIR"
99 ];
100
101 executables = [
102 "Ryujinx"
103 ];
104
105 makeWrapperArgs = lib.optional stdenv.hostPlatform.isLinux [
106 # Without this Ryujinx fails to start on wayland. See https://github.com/Ryujinx/Ryujinx/issues/2714
107 "--set SDL_VIDEODRIVER x11"
108 ];
109
110 preInstall = lib.optionalString stdenv.hostPlatform.isLinux ''
111 # workaround for https://github.com/Ryujinx/Ryujinx/issues/2349
112 mkdir -p $out/lib/sndio-6
113 ln -s ${sndio}/lib/libsndio.so $out/lib/sndio-6/libsndio.so.6
114 '';
115
116 preFixup = ''
117 ${lib.optionalString stdenv.hostPlatform.isLinux ''
118 mkdir -p $out/share/{applications,icons/hicolor/scalable/apps,mime/packages}
119
120 pushd ${src}/distribution/linux
121
122 install -D ./Ryujinx.desktop $out/share/applications/Ryujinx.desktop
123 install -D ./Ryujinx.sh $out/bin/Ryujinx.sh
124 install -D ./mime/Ryujinx.xml $out/share/mime/packages/Ryujinx.xml
125 install -D ../misc/Logo.svg $out/share/icons/hicolor/scalable/apps/Ryujinx.svg
126
127 popd
128 ''}
129
130 # Don't make a softlink on OSX because of its case insensitivity
131 ${lib.optionalString (!stdenv.hostPlatform.isDarwin) "ln -s $out/bin/Ryujinx $out/bin/ryujinx"}
132 '';
133
134 passthru.updateScript = ./updater.sh;
135
136 meta = {
137 homepage = "https://ryujinx.app";
138 changelog = "https://git.ryujinx.app/ryubing/ryujinx/-/wikis/changelog";
139 description = "Experimental Nintendo Switch Emulator written in C# (community fork of Ryujinx)";
140 longDescription = ''
141 Ryujinx is an open-source Nintendo Switch emulator, created by gdkchan,
142 written in C#. This emulator aims at providing excellent accuracy and
143 performance, a user-friendly interface and consistent builds. It was
144 written from scratch and development on the project began in September
145 2017. The project has since been abandoned on October 1st 2024 and QoL
146 updates are now managed under a fork.
147 '';
148 license = lib.licenses.mit;
149 maintainers = with lib.maintainers; [
150 jk
151 artemist
152 willow
153 ];
154 platforms = [
155 "x86_64-linux"
156 "aarch64-linux"
157 "aarch64-darwin"
158 ];
159 mainProgram = "Ryujinx";
160 };
161}