summary refs log tree commit diff
path: root/pkgs/applications/audio/cadence/default.nix
blob: 52f5a6540e8b4274e4cc796168b008fbbc2a4018 (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
76
77
78
79
80
81
{ stdenv
, mkDerivation
, lib
, fetchpatch
, fetchzip
, pkgconfig
, qtbase
, makeWrapper
, python3Packages
}:

 mkDerivation rec {
  version = "0.9.1";
  pname = "cadence";

  src = fetchzip {
    url = "https://github.com/falkTX/Cadence/archive/v${version}.tar.gz";
    sha256 = "07z8grnnpkd0nf3y3r6qjlk1jlzrbhdrp9mnhrhhmws54p1bhl20";
  };

  patches = [
    # Fix installation without DESTDIR
    (fetchpatch {
      url = "https://github.com/falkTX/Cadence/commit/1fd3275e7daf4b75f59ef1f85a9e2e93bd5c0731.patch";
      sha256 = "0q791jsh8vmjg678dzhbp1ykq8xrrlxl1mbgs3g8if1ccj210vd8";
    })
  ];

  nativeBuildInputs = [
    pkgconfig
  ];

  buildInputs = [
    qtbase
  ];

  makeFlags = [
    "PREFIX=${placeholder "out"}"
    "SYSCONFDIR=${placeholder "out"}/etc"
  ];

  propagatedBuildInputs = with python3Packages; [
    pyqt5_with_qtwebkit
  ];

  dontWrapQtApps = true;

  # Replace with our own wrappers. They need to be changed manually since it wouldn't work otherwise.
  preFixup = let
    outRef = placeholder "out";
    prefix = "${outRef}/share/cadence/src";
    scriptAndSource = lib.mapAttrs' (script: source:
      lib.nameValuePair ("${outRef}/bin/" + script) ("${prefix}/" + source)
    ) {
      "cadence" = "cadence.py";
      "claudia" = "claudia.py";
      "catarina" = "catarina.py";
      "catia" = "catia.py";
      "cadence-jacksettings" = "jacksettings.py";
      "cadence-aloop-daemon" = "cadence_aloop_daemon.py";
      "cadence-logs" = "logs.py";
      "cadence-render" = "render.py";
      "claudia-launcher" = "claudia_launcher.py";
      "cadence-session-start" = "cadence_session_start.py";
    };
  in lib.mapAttrsToList (script: source: ''
    rm -f ${script}
    makeWrapper ${python3Packages.python.interpreter} ${script} \
      --set PYTHONPATH "$PYTHONPATH:${outRef}/share/cadence" \
      ''${qtWrapperArgs[@]} \
      --add-flags "-O ${source}"
  '') scriptAndSource;

  meta = {
    homepage = https://github.com/falkTX/Cadence/;
    description = "Collection of tools useful for audio production";
    license = stdenv.lib.licenses.gpl2Plus;
    maintainers = with stdenv.lib.maintainers; [ genesis worldofpeace ];
    platforms = [ "x86_64-linux" ];
  };
}