nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 pkg-config,
7 alsa-lib,
8 fontconfig,
9 freetype,
10 libX11,
11 libXcomposite,
12 libXcursor,
13 libXdmcp,
14 libXext,
15 libXinerama,
16 libXrandr,
17 libXtst,
18}:
19
20stdenv.mkDerivation (finalAttrs: {
21 pname = "SG-323";
22 version = "1.1.0";
23
24 src = fetchFromGitHub {
25 owner = "greyboxaudio";
26 repo = "SG-323";
27 tag = finalAttrs.version;
28 fetchSubmodules = true;
29 hash = "sha256-yAC4YQt8f5kQ03ECAxvoM9wcqna98F4XKcwUQg6l4E0=";
30 };
31
32 nativeBuildInputs = [
33 cmake
34 pkg-config
35 ];
36
37 buildInputs = [
38 fontconfig
39 freetype
40 ]
41 ++ lib.optionals stdenv.isLinux [
42 alsa-lib
43 libX11
44 libXcomposite
45 libXcursor
46 libXdmcp
47 libXext
48 libXinerama
49 libXrandr
50 libXtst
51 ];
52
53 enableParallelBuilding = true;
54
55 env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isLinux (toString [
56 # juce, compiled in this build as part of a Git submodule, uses `-flto` as
57 # a Link Time Optimization flag, and instructs the plugin compiled here to
58 # use this flag to. This breaks the build for us. Using _fat_ LTO allows
59 # successful linking while still providing LTO benefits. If our build of
60 # `juce` was used as a dependency, we could have patched that `-flto` line
61 # in our juce's source, but that is not possible because it is used as a
62 # Git Submodule.
63 "-ffat-lto-objects"
64 ]);
65
66 installPhase =
67 let
68 vst3Dir =
69 if stdenv.hostPlatform.isDarwin then "$out/Library/Audio/Plug-Ins/VST3" else "$out/lib/vst3";
70 # this one's a guess, don't know where ppl have agreed to put them yet
71 clapDir =
72 if stdenv.hostPlatform.isDarwin then "$out/Library/Audio/Plug-Ins/CLAP" else "$out/lib/clap";
73 auDir = "$out/Library/Audio/Plug-Ins/Components";
74 in
75 ''
76 runHook preInstall
77
78 ''
79 + (
80 if stdenv.hostPlatform.isDarwin then
81 ''
82 mkdir -p ${auDir}
83 cp -r "SG323_artefacts/Release/AU/SG-323.component" ${auDir}
84 ''
85 else
86 ''
87 mkdir -p $out/lib/lv2
88 cp -r "SG323_artefacts/Release/LV2/SG-323.lv2" $out/lib/lv2
89 ''
90 )
91 + ''
92 mkdir -p ${vst3Dir} ${clapDir}
93 mv SG323_artefacts/Release/VST3/* ${vst3Dir}
94 mv SG323_artefacts/Release/CLAP/* ${clapDir}
95
96 runHook postInstall
97 '';
98
99 meta = {
100 description = "Ursa Major Stargate 323 reverb plugin";
101 homepage = "https://github.com/greyboxaudio/SG-323";
102 changelog = "https://github.com/greyboxaudio/SG-323/releases/tag/v${finalAttrs.version}";
103 license = lib.licenses.gpl3Plus;
104 maintainers = with lib.maintainers; [ magnetophon ];
105 platforms = lib.platforms.all;
106 };
107})