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
|
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, cmake
, pkg-config
, fmt
, liblo
, alsa-lib
, freetype
, libX11
, libXrandr
, libXinerama
, libXext
, libXcursor
, Foundation
, Cocoa
, Carbon
, CoreServices
, ApplicationServices
, CoreAudio
, CoreMIDI
, AudioToolbox
, Accelerate
, CoreImage
, IOKit
, AudioUnit
, QuartzCore
, WebKit
, DiscRecording
, CoreAudioKit
# Enabling JACK requires a JACK server at runtime, no fallback mechanism
, withJack ? false, jack
, type ? "ADL"
}:
assert lib.assertOneOf "type" type [ "ADL" "OPN" ];
let
chip = {
ADL = "OPL3";
OPN = "OPN2";
}.${type};
mainProgram = "${type}plug";
in
stdenv.mkDerivation rec {
pname = "${lib.strings.toLower type}plug";
version = "unstable-2021-12-17";
src = fetchFromGitHub {
owner = "jpcima";
repo = "ADLplug";
rev = "a488abedf1783c61cb4f0caa689f1b01bf9aa17d";
fetchSubmodules = true;
sha256 = "1a5zw0rglqgc5wq1n0s5bxx7y59dsg6qy02236fakl34bvbk60yz";
};
cmakeFlags = [
"-DADLplug_CHIP=${chip}"
"-DADLplug_USE_SYSTEM_FMT=ON"
"-DADLplug_Jack=${if withJack then "ON" else "OFF"}"
];
NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isDarwin (toString [
# "fp.h" file not found
"-isystem ${CoreServices}/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Headers"
]);
NIX_LDFLAGS = toString (lib.optionals stdenv.hostPlatform.isDarwin [
# Framework that JUCE needs which don't get linked properly
"-framework CoreAudioKit"
"-framework QuartzCore"
"-framework AudioToolbox"
] ++ lib.optionals stdenv.hostPlatform.isLinux [
# JUCE dlopen's these at runtime
"-lX11"
"-lXext"
"-lXcursor"
"-lXinerama"
"-lXrandr"
]);
nativeBuildInputs = [
cmake
pkg-config
];
buildInputs = [
fmt
liblo
] ++ lib.optionals stdenv.hostPlatform.isLinux [
alsa-lib
freetype
libX11
libXrandr
libXinerama
libXext
libXcursor
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
Foundation
Cocoa
Carbon
CoreServices
ApplicationServices
CoreAudio
CoreMIDI
AudioToolbox
Accelerate
CoreImage
IOKit
AudioUnit
QuartzCore
WebKit
DiscRecording
CoreAudioKit
] ++ lib.optional withJack jack;
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p $out/{Applications,Library/Audio/Plug-Ins/{VST,Components}}
mv $out/bin/${mainProgram}.app $out/Applications/
ln -s $out/{Applications/${mainProgram}.app/Contents/MacOS,bin}/${mainProgram}
mv vst2/${mainProgram}.vst $out/Library/Audio/Plug-Ins/VST/
mv au/${mainProgram}.component $out/Library/Audio/Plug-Ins/Components/
'';
meta = with lib; {
inherit mainProgram;
description = "${chip} FM Chip Synthesizer";
homepage = src.meta.homepage;
license = licenses.boost;
platforms = platforms.all;
maintainers = with maintainers; [ OPNA2608 ];
};
}
|