nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 pkg-config,
6 alsa-lib,
7 freetype,
8 libX11,
9 libXrandr,
10 libXinerama,
11 libXext,
12 libXcursor,
13 makeDesktopItem,
14 copyDesktopItems,
15}:
16
17stdenv.mkDerivation (finalAttrs: {
18 pname = "show-midi";
19 version = "1.0.1";
20
21 src = fetchFromGitHub {
22 owner = "gbevin";
23 repo = "ShowMIDI";
24 rev = finalAttrs.version;
25 hash = "sha256-jANrFZqJZZMTGyNa0sIthoQzaDMdLzpGZqHfxNw8hDg=";
26 fetchSubmodules = true;
27 };
28
29 nativeBuildInputs = [
30 pkg-config
31 copyDesktopItems
32 ];
33 buildInputs = [
34 alsa-lib
35 freetype
36 libX11
37 libXrandr
38 libXinerama
39 libXext
40 libXcursor
41 ];
42
43 enableParallelBuilding = true;
44
45 makeFlags = [
46 "-C Builds/LinuxMakefile"
47 "CONFIG=Release"
48 # Specify targets by hand, because it tries to build VST by default,
49 # even though it's not supported in JUCE anymore
50 "LV2"
51 "LV2_MANIFEST_HELPER"
52 "Standalone"
53 "VST3"
54 "VST3_MANIFEST_HELPER"
55 ];
56
57 installPhase = ''
58 runHook preInstall
59
60 install -Dt $out/share/ShowMIDI/themes Themes/*
61
62 install -D Design/icon.png $out/share/icons/hicolor/1024x1024/apps/show-midi.png
63
64 mkdir -p $out/bin $out/lib/lv2 $out/lib/vst3
65 cd Builds/LinuxMakefile/build/
66 cp -r ShowMIDI.lv2 $out/lib/lv2
67 cp -r ShowMIDI.vst3 $out/lib/vst3
68 cp ShowMIDI $out/bin
69
70 runHook postInstall
71 '';
72
73 desktopItems = [
74 (makeDesktopItem {
75 name = "ShowMIDI";
76 exec = finalAttrs.meta.mainProgram;
77 comment = finalAttrs.meta.description;
78 type = "Application";
79 icon = "show-midi";
80 desktopName = "ShowMIDI";
81 categories = [ "Audio" ];
82 })
83 ];
84
85 # JUCE dlopens these, make sure they are in rpath
86 # Otherwise, segfault will happen
87 env.NIX_LDFLAGS = toString [
88 "-lX11"
89 "-lXext"
90 "-lXcursor"
91 "-lXinerama"
92 "-lXrandr"
93 ];
94
95 meta = with lib; {
96 description = "Multi-platform GUI application to effortlessly visualize MIDI activity";
97 homepage = "https://github.com/gbevin/ShowMIDI";
98 license = licenses.gpl3Only;
99 maintainers = with maintainers; [ minijackson ];
100 mainProgram = "ShowMIDI";
101 platforms = platforms.linux;
102 };
103})