1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 ensureNewerSourcesForZipFilesHook,
6 makeDesktopItem,
7 copyDesktopItems,
8 cmake,
9 pkg-config,
10 alsa-lib,
11 freetype,
12 webkitgtk_4_1,
13 zenity,
14 curl,
15 xorg,
16 python3,
17 libsysprof-capture,
18 pcre2,
19 util-linux,
20 libselinux,
21 libsepol,
22 libthai,
23 libxkbcommon,
24 libdatrie,
25 libepoxy,
26 libGL,
27 libjack2,
28 lerc,
29 sqlite,
30 expat,
31 makeWrapper,
32 nix-update-script,
33}:
34let
35 version = "0.9.1";
36in
37stdenv.mkDerivation {
38 pname = "plugdata";
39 inherit version;
40
41 src = fetchFromGitHub {
42 owner = "plugdata-team";
43 repo = "plugdata";
44 tag = "v${version}";
45 hash = "sha256-dcggq455lZiwl1lps11fuKX6sx0A8UtFwFoiBJWtwFQ=";
46 fetchSubmodules = true;
47 };
48
49 nativeBuildInputs = [
50 cmake
51 pkg-config
52 ensureNewerSourcesForZipFilesHook
53 copyDesktopItems
54 python3
55 makeWrapper
56 ];
57
58 buildInputs = [
59 alsa-lib
60 curl
61 freetype
62 webkitgtk_4_1
63 xorg.libX11
64 xorg.libXcursor
65 xorg.libXext
66 xorg.libXinerama
67 xorg.libXrender
68 xorg.libXrandr
69 xorg.libXdmcp
70 xorg.libXtst
71 xorg.xvfb
72 libsysprof-capture
73 pcre2
74 util-linux
75 libGL
76 libselinux
77 libsepol
78 libthai
79 libxkbcommon
80 libdatrie
81 libepoxy
82 lerc
83 libjack2
84 expat
85 sqlite
86 ];
87
88 desktopItems = [
89 (makeDesktopItem {
90 name = "PlugData";
91 desktopName = "PlugData";
92 exec = "plugdata";
93 icon = "plugdata_logo";
94 comment = "Pure Data as a plugin, with a new GUI";
95 type = "Application";
96 categories = [
97 "AudioVideo"
98 "Music"
99 ];
100 })
101 ];
102
103 NIX_LDFLAGS = (
104 toString [
105 "-lX11"
106 "-lXext"
107 "-lXcomposite"
108 "-lXcursor"
109 "-lXinerama"
110 "-lXrandr"
111 "-lXtst"
112 "-lXdmcp"
113 ]
114 );
115
116 preBuild = ''
117 # fix LV2 build
118 HOME=$(mktemp -d)
119 '';
120
121 installPhase = ''
122 runHook preInstall
123
124 cd .. # build artifacts are placed inside the source directory for some reason
125 mkdir -p $out/bin $out/lib/clap $out/lib/lv2 $out/lib/vst3
126 cp Plugins/Standalone/plugdata $out/bin
127 cp -r Plugins/CLAP/plugdata{,-fx}.clap $out/lib/clap
128 cp -r Plugins/VST3/plugdata{,-fx}.vst3 $out/lib/vst3
129 cp -r Plugins/LV2/plugdata{,-fx}.lv2 $out/lib/lv2
130
131 install -Dm444 $src/Resources/Icons/plugdata_logo_linux.png $out/share/pixmaps/plugdata_logo.png
132
133 runHook postInstall
134 '';
135
136 postInstall = ''
137 # Ensure zenity is available, or it won't be able to open new files.
138 wrapProgram $out/bin/plugdata \
139 --prefix PATH : '${
140 lib.makeBinPath [
141 zenity
142 ]
143 }'
144 '';
145
146 passthru.updateScript = nix-update-script { };
147
148 meta = {
149 description = "Plugin wrapper around Pure Data to allow patching in a wide selection of DAWs";
150 mainProgram = "plugdata";
151 homepage = "https://plugdata.org/";
152 license = lib.licenses.gpl3;
153 platforms = lib.platforms.linux;
154 maintainers = [
155 lib.maintainers.PowerUser64
156 lib.maintainers.l1npengtul
157 ];
158 };
159}