1{
2 stdenv,
3 fetchurl,
4 cmake,
5 dbus,
6 fftwFloat,
7 file,
8 freetype,
9 jansson,
10 lib,
11 libGL,
12 libX11,
13 libXcursor,
14 libXext,
15 libXrandr,
16 libarchive,
17 libjack2,
18 liblo,
19 libsamplerate,
20 libsndfile,
21 makeWrapper,
22 pkg-config,
23 python3,
24 speexdsp,
25 libglvnd,
26 headless ? false,
27}:
28
29stdenv.mkDerivation rec {
30 pname = "cardinal";
31 version = "25.06";
32
33 src = fetchurl {
34 url = "https://github.com/DISTRHO/Cardinal/releases/download/${version}/cardinal+deps-${version}.tar.xz";
35 hash = "sha256-siZbbYrMGjhiof2M2ZBl2gekePuwsKvR8uZCdjyywiE=";
36 };
37
38 prePatch = ''
39 patchShebangs ./dpf/utils/generate-ttl.sh
40 '';
41
42 dontUseCmakeConfigure = true;
43 enableParallelBuilding = true;
44 strictDeps = true;
45
46 nativeBuildInputs = [
47 cmake
48 file
49 pkg-config
50 makeWrapper
51 python3
52 ];
53
54 buildInputs = [
55 dbus
56 fftwFloat
57 freetype
58 jansson
59 libGL
60 libX11
61 libXcursor
62 libXext
63 libXrandr
64 libarchive
65 liblo
66 libsamplerate
67 libsndfile
68 speexdsp
69 libglvnd
70 ];
71
72 hardeningDisable = [ "format" ];
73 makeFlags = [
74 "SYSDEPS=true"
75 "PREFIX=$(out)"
76 ]
77 ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "CROSS_COMPILING=true"
78 ++ lib.optional headless "HEADLESS=true";
79
80 postInstall = ''
81 wrapProgram $out/bin/Cardinal \
82 --suffix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ libjack2 ]}
83
84 wrapProgram $out/bin/CardinalMini \
85 --suffix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ libjack2 ]}
86
87 # this doesn't work and is mainly just a test tool for the developers anyway.
88 rm -f $out/bin/CardinalNative
89 '';
90
91 meta = {
92 description = "Plugin wrapper around VCV Rack";
93 homepage = "https://github.com/DISTRHO/cardinal";
94 license = lib.licenses.gpl3;
95 maintainers = with lib.maintainers; [
96 magnetophon
97 PowerUser64
98 ];
99 mainProgram = "Cardinal";
100 platforms = lib.platforms.all;
101 # never built on aarch64-darwin, x86_64-darwin since first introduction in nixpkgs
102 broken = stdenv.hostPlatform.isDarwin;
103 };
104}