about summary refs log tree commit diff
path: root/pkgs/applications/audio/midivisualizer/default.nix
blob: 10a2a5de6a096fd721011cef100059fd076af0bc (plain) (blame)
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
{ lib
, stdenv
, fetchFromGitHub
, cmake
, pkg-config
, libX11
, glfw
, makeWrapper
, libXrandr
, libXinerama
, libXcursor
, gtk3
, ffmpeg-full
, AppKit
, Carbon
, Cocoa
, CoreAudio
, CoreMIDI
, CoreServices
, Kernel
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "midivisualizer";
  version = "7.0";

  src = fetchFromGitHub {
    owner = "kosua20";
    repo = "MIDIVisualizer";
    rev = "v${finalAttrs.version}";
    sha256 = "sha256-wfPSPH+E9cErVvfJZqHttFtjiUYJopM/u6w6NpRHifE=";
  };

  nativeBuildInputs = [ cmake pkg-config makeWrapper];

  buildInputs = [
    glfw
    ffmpeg-full
  ] ++ lib.optionals stdenv.isLinux [
    libX11
    libXrandr
    libXinerama
    libXcursor
    gtk3
  ] ++ lib.optionals stdenv.isDarwin [
    AppKit
    Carbon
    Cocoa
    CoreAudio
    CoreMIDI
    CoreServices
    Kernel
  ];

  installPhase = if stdenv.isDarwin then ''
    mkdir -p $out/Applications $out/bin
    cp -r MIDIVisualizer.app $out/Applications/
    ln -s ../Applications/MIDIVisualizer.app/Contents/MacOS/MIDIVisualizer $out/bin/
  '' else ''
    mkdir -p $out/bin
    cp MIDIVisualizer $out/bin

    wrapProgram $out/bin/MIDIVisualizer \
      --prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}:$XDG_DATA_DIRS"
  '';

  meta = with lib; {
    description = "Small MIDI visualizer tool, using OpenGL";
    mainProgram = "MIDIVisualizer";
    homepage = "https://github.com/kosua20/MIDIVisualizer";
    license = licenses.mit;
    platforms = platforms.unix;
    maintainers = [ maintainers.ericdallo ];
  };
})