11 , withWaveWrite ? true
12 , withWinMM ? stdenv.hostPlatform.isWindows
13 , withDirectSound ? stdenv.hostPlatform.isWindows
14 , withXAudio2 ? stdenv.hostPlatform.isWindows
15 , withWASAPI ? stdenv.hostPlatform.isWindows
16 , withOSS ? stdenv.hostPlatform.isFreeBSD
17 , withSADA ? stdenv.hostPlatform.isSunOS
18 , withALSA ? stdenv.hostPlatform.isLinux
20 , withPulseAudio ? stdenv.hostPlatform.isLinux
22 , withCoreAudio ? stdenv.hostPlatform.isDarwin
28 , enableEmulation ? true
29 , withAllEmulators ? true
32 , enableLibplayer ? true
37 assert enableTools -> enableAudio && enableEmulation && enableLibplayer;
40 inherit (lib) optional optionals;
41 onOff = val: if val then "ON" else "OFF";
43 stdenv.mkDerivation rec {
45 version = "unstable-2022-08-02";
47 src = fetchFromGitHub {
50 rev = "0e349256338144205303a1495ddc788a854be1eb";
51 sha256 = "FNNPiIfBUxkwgEbiFebPGn6ZIxv3ypDefcOzC6r94hE=";
57 ] ++ optional enableTools "bin";
63 propagatedBuildInputs = [
66 ] ++ optionals withALSA [
68 ] ++ optionals withPulseAudio [
70 ] ++ optionals withCoreAudio [
73 ] ++ optionals withLibao [
78 "-DBUILD_LIBAUDIO=${onOff enableAudio}"
79 "-DBUILD_LIBEMU=${onOff enableEmulation}"
80 "-DBUILD_LIBPLAYER=${onOff enableLibplayer}"
81 "-DBUILD_TESTS=${onOff enableTools}"
82 "-DBUILD_PLAYER=${onOff enableTools}"
83 "-DBUILD_VGM2WAV=${onOff enableTools}"
84 "-DLIBRARY_TYPE=${if enableShared then "SHARED" else "STATIC"}"
86 ] ++ optionals enableAudio [
87 "-DAUDIODRV_WAVEWRITE=${onOff withWaveWrite}"
88 "-DAUDIODRV_WINMM=${onOff withWinMM}"
89 "-DAUDIODRV_DSOUND=${onOff withDirectSound}"
90 "-DAUDIODRV_XAUDIO2=${onOff withXAudio2}"
91 "-DAUDIODRV_WASAPI=${onOff withWASAPI}"
92 "-DAUDIODRV_OSS=${onOff withOSS}"
93 "-DAUDIODRV_SADA=${onOff withSADA}"
94 "-DAUDIODRV_ALSA=${onOff withALSA}"
95 "-DAUDIODRV_PULSE=${onOff withPulseAudio}"
96 "-DAUDIODRV_APPLE=${onOff withCoreAudio}"
97 "-DAUDIODRV_LIBAO=${onOff withLibao}"
98 ] ++ optionals enableEmulation ([
99 "-DSNDEMU__ALL=${onOff withAllEmulators}"
100 ] ++ optionals (!withAllEmulators)
101 (lib.lists.forEach emulators (x: "-DSNDEMU_${x}=ON"))
102 ) ++ optionals enableTools [
103 "-DUTIL_CHARCNV_ICONV=ON"
104 "-DUTIL_CHARCNV_WINAPI=${onOff stdenv.hostPlatform.isWindows}"
107 passthru.updateScript = unstableGitUpdater {
108 url = "https://github.com/ValleyBell/libvgm.git";
112 homepage = "https://github.com/ValleyBell/libvgm";
113 description = "More modular rewrite of most components from VGMPlay";
115 if (enableEmulation && (withAllEmulators || (lib.lists.any (core: core == "WSWAN_ALL") emulators))) then
116 licenses.unfree # https://github.com/ValleyBell/libvgm/issues/43
119 maintainers = with maintainers; [ OPNA2608 ];
120 platforms = platforms.all;