nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 SDL2,
4 cmake,
5 fetchFromGitHub,
6 ffmpeg,
7 discord-rpc,
8 libedit,
9 elfutils,
10 libepoxy,
11 libsForQt5,
12 libzip,
13 lua,
14 minizip,
15 pkg-config,
16 stdenv,
17 wrapGAppsHook3,
18 enableDiscordRpc ? false,
19}:
20
21let
22 inherit (libsForQt5)
23 qtbase
24 qtmultimedia
25 qttools
26 wrapQtAppsHook
27 qtwayland
28 ;
29in
30stdenv.mkDerivation (finalAttrs: {
31 pname = "mgba";
32 version = "0.10.5";
33
34 src = fetchFromGitHub {
35 owner = "mgba-emu";
36 repo = "mgba";
37 tag = finalAttrs.version;
38 hash = "sha256-Za2o06odeisnrE3i7w54OeaPXHscZAaD1+EXii7bnuk=";
39 };
40
41 outputs = [
42 "out"
43 "dev"
44 "doc"
45 "lib"
46 "man"
47 ];
48
49 nativeBuildInputs = [
50 SDL2
51 cmake
52 pkg-config
53 wrapGAppsHook3
54 wrapQtAppsHook
55 ];
56
57 buildInputs = [
58 SDL2
59 ffmpeg
60 libedit
61 elfutils
62 libepoxy
63 libzip
64 lua
65 minizip
66 qtbase
67 qtmultimedia
68 qttools
69 ]
70 ++ lib.optionals enableDiscordRpc [ discord-rpc ]
71 ++ lib.optionals stdenv.hostPlatform.isLinux [ qtwayland ];
72
73 cmakeFlags = [
74 # TODO: drop in the next version bump
75 (lib.cmakeFeature "CMAKE_POLICY_VERSION_MINIMUM" "3.10")
76 (lib.cmakeBool "USE_DISCORD_RPC" enableDiscordRpc)
77 ];
78
79 strictDeps = true;
80
81 dontWrapGApps = true;
82
83 preFixup = ''
84 qtWrapperArgs+=("''${gappsWrapperArgs[@]}")
85 '';
86
87 meta = {
88 homepage = "https://mgba.io";
89 description = "Modern GBA emulator with a focus on accuracy";
90 longDescription = ''
91 mGBA is a new Game Boy Advance emulator written in C.
92
93 The project started in April 2013 with the goal of being fast enough to
94 run on lower end hardware than other emulators support, without
95 sacrificing accuracy or portability. Even in the initial version, games
96 generally play without problems. It is loosely based on the previous
97 GBA.js emulator, although very little of GBA.js can still be seen in mGBA.
98
99 Other goals include accurate enough emulation to provide a development
100 environment for homebrew software, a good workflow for tool-assist
101 runners, and a modern feature set for emulators that older emulators may
102 not support.
103 '';
104 changelog = "https://raw.githubusercontent.com/mgba-emu/mgba/${finalAttrs.src.rev}/CHANGES";
105 license = with lib.licenses; [ mpl20 ];
106 mainProgram = "mgba";
107 maintainers = with lib.maintainers; [ Gliczy ];
108 platforms = lib.platforms.linux;
109 broken = enableDiscordRpc; # Some obscure `ld` error
110 };
111})