From 7d96814b2907cd77705faecc928625fc64936533 Mon Sep 17 00:00:00 2001 From: Niols Date: Wed, 16 Nov 2022 00:14:50 +0100 Subject: [PATCH] timidity: add enableVorbis option TiMidity++ can not only play sounds, but also can save the generated waveforms as various audio file formats. The current package only supports Linux and Darwin outputs to play sound, but it does not support saving sounds as eg. vorbis. This commit adds an optional flag `enableVorbis` to the package, disabled by default. This does not change the semantics of the current package but it allows users that need such support to curate their own set of packages with a `callPackage timidity { enableVorbis = true; }`. --- pkgs/tools/misc/timidity/default.nix | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/misc/timidity/default.nix b/pkgs/tools/misc/timidity/default.nix index ce6e0c7ae8f0..6eea29f73a80 100644 --- a/pkgs/tools/misc/timidity/default.nix +++ b/pkgs/tools/misc/timidity/default.nix @@ -9,6 +9,9 @@ , ncurses , alsa-lib , buildPackages + +## Additional optional output modes +, enableVorbis ? false, libvorbis }: stdenv.mkDerivation rec { @@ -29,6 +32,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ pkg-config ] ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [ memstreamHook ]; + buildInputs = [ libjack2 ncurses @@ -37,19 +41,31 @@ stdenv.mkDerivation rec { ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ CoreAudio libobjc + ] ++ lib.optionals enableVorbis [ + libvorbis + ]; + + enabledOutputModes = [ + "jack" + ] ++ lib.optionals stdenv.hostPlatform.isLinux [ + "oss" + "alsa" + ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ + "darwin" + ] ++ lib.optionals enableVorbis [ + "vorbis" ]; configureFlags = [ "--enable-ncurses" + ("--enable-audio=" + builtins.concatStringsSep "," enabledOutputModes) "lib_cv_va_copy=yes" "lib_cv___va_copy=yes" ] ++ lib.optionals stdenv.hostPlatform.isLinux [ - "--enable-audio=oss,alsa,jack" "--enable-alsaseq" "--with-default-output=alsa" "lib_cv_va_val_copy=yes" ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ - "--enable-audio=darwin,jack" "lib_cv_va_val_copy=no" "timidity_cv_ccoption_rdynamic=yes" # These configure tests fail because of incompatible function pointer conversions.