From 97abff668dccb48de27d82961947062e257b3820 Mon Sep 17 00:00:00 2001 From: Bart Brouns Date: Sun, 9 Nov 2025 06:16:04 +0100 Subject: [PATCH] zlcompressor: init at 0.2.1 --- pkgs/by-name/zl/zlcompressor/package.nix | 120 +++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 pkgs/by-name/zl/zlcompressor/package.nix diff --git a/pkgs/by-name/zl/zlcompressor/package.nix b/pkgs/by-name/zl/zlcompressor/package.nix new file mode 100644 index 000000000000..a6bda5c5f0fe --- /dev/null +++ b/pkgs/by-name/zl/zlcompressor/package.nix @@ -0,0 +1,120 @@ +{ + lib, + clangStdenv, + fetchFromGitHub, + + # nativeBuildInputs + cmake, + darwin, + ninja, + pkg-config, + writableTmpDirAsHomeHook, + + # buildInputs + alsa-lib, + curl, + expat, + fontconfig, + freetype, + libGL, + libXcursor, + libXext, + libXinerama, + libXrandr, + libepoxy, + libjack2, + libxkbcommon, + lv2, +}: + +clangStdenv.mkDerivation (finalAttrs: { + pname = "zlcompressor"; + version = "0.2.1"; + + src = fetchFromGitHub { + owner = "ZL-Audio"; + repo = "ZLCompressor"; + tag = "${finalAttrs.version}"; + hash = "sha256-0Z29+jLtAtThFaVVqvuqUJkj1VRI69WOvIbEfE45db4="; + fetchSubmodules = true; + }; + + nativeBuildInputs = [ + cmake + ninja + pkg-config + writableTmpDirAsHomeHook + ] + ++ lib.optionals clangStdenv.hostPlatform.isDarwin [ darwin.sigtool ]; + + buildInputs = [ + curl + expat + fontconfig + freetype + lv2 + ] + ++ lib.optionals clangStdenv.hostPlatform.isLinux [ + alsa-lib + libGL + libXcursor + libXext + libXinerama + libXrandr + libepoxy + libjack2 + libxkbcommon + ]; + + # JUCE dlopen's these at runtime, crashes without them + NIX_LDFLAGS = lib.optionalString clangStdenv.hostPlatform.isLinux (toString [ + "-lX11" + "-lXext" + "-lXcursor" + "-lXinerama" + "-lXrandr" + ]); + + # LTO needs special setup on Linux + postPatch = lib.optionalString clangStdenv.hostPlatform.isLinux '' + substituteInPlace CMakeLists.txt \ + --replace-fail 'juce::juce_recommended_lto_flags' '# Not forcing LTO' + ''; + + cmakeFlags = [ + # see: https://github.com/ZL-Audio/ZlEqualizer#clone-and-build + (lib.cmakeFeature "KFR_ARCHS" ( + if clangStdenv.hostPlatform.isAarch64 then "neon64" else "sse2;avx;avx2" + )) + (lib.cmakeBool "ZL_JUCE_COPY_PLUGIN" false) + ]; + + installPhase = '' + runHook preInstall + '' + + lib.optionalString clangStdenv.hostPlatform.isLinux '' + mkdir -p $out/lib/{lv2,vst3} + mkdir -p $out/bin/ + cp -r "ZLCompressor_artefacts/Release/LV2/ZL Compressor.lv2" $out/lib/lv2/ + cp -r "ZLCompressor_artefacts/Release/VST3/ZL Compressor.vst3" $out/lib/vst3/ + install -Dm755 "ZLCompressor_artefacts/Release/Standalone/ZL Compressor" $out/bin/ + '' + + lib.optionalString clangStdenv.hostPlatform.isDarwin '' + mkdir -p $out/Applications + cp -r ZLCompressor_artefacts/Release/{AU,VST3} $out/ + cp -r ZLCompressor_artefacts/Release/Standalone/* $out/Applications/ + '' + + '' + runHook postInstall + ''; + + meta = { + homepage = "https://zl-audio.github.io/plugins/zlcompressor/"; + description = "Versatile compressor plugin for VST3, LV2 and standalone"; + license = lib.licenses.agpl3Plus; + maintainers = with lib.maintainers; [ + magnetophon + ]; + platforms = lib.platforms.linux ++ lib.platforms.darwin; + }; +})