From 100a740c0fd7aa74f9168c07fa23f8fdc13fe19c Mon Sep 17 00:00:00 2001 From: Walter Huf Date: Wed, 10 Apr 2024 09:59:53 -0700 Subject: [PATCH] audacious: add vgmstream plugin --- pkgs/applications/audio/audacious/plugins.nix | 5 ++++ pkgs/applications/audio/vgmstream/default.nix | 28 ++++++++++++++----- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/pkgs/applications/audio/audacious/plugins.nix b/pkgs/applications/audio/audacious/plugins.nix index 6f5d171e2ef1..2d048bc358fe 100644 --- a/pkgs/applications/audio/audacious/plugins.nix +++ b/pkgs/applications/audio/audacious/plugins.nix @@ -41,6 +41,7 @@ , qtmultimedia , qtx11extras , soxr +, vgmstream , wavpack }: @@ -109,6 +110,10 @@ stdenv.mkDerivation rec { dontWrapQtApps = true; + postInstall = '' + ln -s ${vgmstream.override { buildAudaciousPlugin = true; }}/lib/audacious/Input/* $out/lib/audacious/Input + ''; + meta = audacious.meta // { description = "Plugins for Audacious music player"; }; diff --git a/pkgs/applications/audio/vgmstream/default.nix b/pkgs/applications/audio/vgmstream/default.nix index ed8cb27b506e..99802872ef03 100644 --- a/pkgs/applications/audio/vgmstream/default.nix +++ b/pkgs/applications/audio/vgmstream/default.nix @@ -1,6 +1,7 @@ -{ stdenv, lib, fetchFromGitHub, cmake, pkg-config -, mpg123, ffmpeg, libvorbis, libao, jansson, speex +{ stdenv, lib, fetchFromGitHub, cmake, pkg-config, gtk3 +, audacious, mpg123, ffmpeg, libvorbis, libao, jansson, speex , nix-update-script +, buildAudaciousPlugin ? false # only build cli by default, pkgs.audacious-plugins sets this to enable plugin support }: stdenv.mkDerivation rec { @@ -19,16 +20,29 @@ stdenv.mkDerivation rec { extraArgs = [ "--version-regex" "r(.*)" ]; }; - nativeBuildInputs = [ cmake pkg-config ]; + nativeBuildInputs = [ + cmake + pkg-config + ] ++ lib.optional buildAudaciousPlugin gtk3; - buildInputs = [ mpg123 ffmpeg libvorbis libao jansson speex ]; + buildInputs = [ + mpg123 + ffmpeg + libvorbis + libao + jansson + speex + ] ++ lib.optional buildAudaciousPlugin (audacious.override { audacious-plugins = null; }); + + preConfigure = '' + substituteInPlace cmake/dependencies/audacious.cmake \ + --replace "pkg_get_variable(AUDACIOUS_PLUGIN_DIR audacious plugin_dir)" "set(AUDACIOUS_PLUGIN_DIR \"$out/lib/audacious\")" + ''; cmakeFlags = [ - # There's no nice way to build the audacious plugin without a circular dependency - "-DBUILD_AUDACIOUS=OFF" # It always tries to download it, no option to use the system one "-DUSE_CELT=OFF" - ]; + ] ++ lib.optional (! buildAudaciousPlugin) "-DBUILD_AUDACIOUS=OFF"; meta = with lib; { description = "A library for playback of various streamed audio formats used in video games";