nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 mkDerivation,
5 fetchFromGitHub,
6 alsa-lib,
7 cmake,
8 libpulseaudio,
9 libmt32emu,
10 pkg-config,
11 portaudio,
12 qtbase,
13 qtmultimedia,
14 withJack ? stdenv.hostPlatform.isUnix,
15 libjack2,
16}:
17
18let
19 char2underscore = char: str: lib.replaceStrings [ char ] [ "_" ] str;
20in
21mkDerivation rec {
22 pname = "mt32emu-qt";
23 version = "1.11.1";
24
25 src = fetchFromGitHub {
26 owner = "munt";
27 repo = "munt";
28 rev = "${char2underscore "-" pname}_${char2underscore "." version}";
29 sha256 = "sha256-PqYPYnKPlnU3PByxksBscl4GqDRllQdmD6RWpy/Ura0=";
30 };
31
32 postPatch = ''
33 sed -i -e '/add_subdirectory(mt32emu)/d' CMakeLists.txt
34 '';
35
36 nativeBuildInputs = [
37 cmake
38 pkg-config
39 ];
40
41 buildInputs = [
42 libmt32emu
43 portaudio
44 qtbase
45 qtmultimedia
46 ]
47 ++ lib.optionals stdenv.hostPlatform.isLinux [
48 alsa-lib
49 libpulseaudio
50 ]
51 ++ lib.optional withJack libjack2;
52
53 dontFixCmake = true;
54
55 cmakeFlags = [
56 "-Dmt32emu-qt_USE_PULSEAUDIO_DYNAMIC_LOADING=OFF"
57 "-Dmunt_WITH_MT32EMU_QT=ON"
58 "-Dmunt_WITH_MT32EMU_SMF2WAV=OFF"
59 ];
60
61 postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
62 mkdir $out/Applications
63 mv $out/bin/${pname}.app $out/Applications/
64 ln -s $out/{Applications/${pname}.app/Contents/MacOS,bin}/${pname}
65 '';
66
67 meta = with lib; {
68 homepage = "https://munt.sourceforge.net/";
69 description = "Synthesizer application built on Qt and libmt32emu";
70 mainProgram = "mt32emu-qt";
71 longDescription = ''
72 mt32emu-qt is a synthesiser application that facilitates both realtime
73 synthesis and conversion of pre-recorded SMF files to WAVE making use of
74 the mt32emu library and the Qt framework.
75 '';
76 license = with licenses; [ gpl3Plus ];
77 maintainers = with maintainers; [ OPNA2608 ];
78 platforms = platforms.all;
79 };
80}