diff --git a/pkgs/by-name/si/sirial/package.nix b/pkgs/by-name/si/sirial/package.nix new file mode 100644 index 000000000000..ec2f6325c5c4 --- /dev/null +++ b/pkgs/by-name/si/sirial/package.nix @@ -0,0 +1,108 @@ +{ + lib, + stdenv, + fetchFromGitHub, + cmake, + pkg-config, + alsa-lib, + fontconfig, + freetype, + libx11, + libxcomposite, + libxcursor, + libxdmcp, + libxext, + libxinerama, + libxrandr, + libxtst, + writableTmpDirAsHomeHook, + + buildVST3 ? true, + buildLV2 ? stdenv.isLinux, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "sirial"; + version = "1.1.1"; + + src = fetchFromGitHub { + owner = "tiagolr"; + repo = "sirial"; + tag = "v${finalAttrs.version}"; + fetchSubmodules = true; + hash = "sha256-Mx+DzNaj+oS9piQvBgMVMJl3+ZVg8NjJkh/WU/fMZ74="; + }; + + nativeBuildInputs = [ + cmake + pkg-config + writableTmpDirAsHomeHook # fontconfig cache + ]; + + buildInputs = [ + fontconfig + freetype + ] + ++ lib.optionals stdenv.isLinux [ + alsa-lib + libx11 + libxcomposite + libxcursor + libxdmcp + libxext + libxinerama + libxrandr + libxtst + ]; + + enableParallelBuilding = true; + + cmakeFlags = [ + (lib.cmakeBool "COPY_PLUGIN_AFTER_BUILD" false) + (lib.cmakeBool "BUILD_STANDALONE" false) + (lib.cmakeBool "BUILD_VST3" buildVST3) + (lib.cmakeBool "BUILD_LV2" buildLV2) + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + "-DCMAKE_OSX_ARCHITECTURES=${stdenv.hostPlatform.darwinArch}" + ]; + + env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isLinux (toString [ + # juce, compiled in this build as part of a Git submodule, uses `-flto` as + # a Link Time Optimization flag, and instructs the plugin compiled here to + # use this flag to. This breaks the build for us. Using _fat_ LTO allows + # successful linking while still providing LTO benefits. If our build of + # `juce` was used as a dependency, we could have patched that `-flto` line + # in our juce's source, but that is not possible because it is used as a + # Git Submodule. + "-ffat-lto-objects" + ]); + + installPhase = '' + runHook preInstall + + pushd Sirial_artefacts/Release + ${lib.optionalString buildVST3 '' + mkdir -p $out/lib/vst3 + cp -r VST3/Sirial.vst3 $out/lib/vst3 + ''} + ${lib.optionalString buildLV2 '' + mkdir -p $out/lib/lv2 + cp -r LV2/Sirial.lv2 $out/lib/lv2 + ''} + popd + + runHook postInstall + ''; + + meta = { + description = "Rhythmic delay with 16 serial delay lines for intricate patterns"; + homepage = "https://github.com/tiagolr/sirial"; + changelog = "https://github.com/tiagolr/sirial/releases/tag/v${finalAttrs.version}"; + license = lib.licenses.gpl3Plus; + maintainers = with lib.maintainers; [ + magnetophon + ]; + platforms = lib.platforms.all; + }; +})