Change:
The audacious package imports audacious-plugins to build most of the common plugins and then link them into the audacious lib path. However, this makes it hard to add more audacious plugins, like vgmstream. The vgmstream package currently has its , because importing the audacious package causes an infinite recursion error. Steps to reproduce the behavior: vgmstream to audacious-plugins buildInputs audacious to vgmstream's buildInputs and comment out the disable configure flag -shell -p audacious-plugins I expected that adding vgmstream to audacious-plugins would enable the plugin. Instead, the build crashes with an infinite recursion. How is it currently working for audacious to import audacious-plugins and audacious-plugins to import audacious? Can this same magic be extended to other plugins? This about how fcitx is packaged shows that fcitx-addons imports fcitx with no reverse import, should the audacious package be refactored to be similar? Should the audacious package gain an extra parameter to take extra plugin derivations, which can be created outside of the audacious-plugins derivation? Add a :+1: [reaction] to [issues you find important]. [reaction]: [issues you find important]:
Instead of adding , did you try to add instead? is without as input, and it is used to break the loop.
Thank you for the quick response! That would be elegant, but I don't see any result in my grep of nixpkgs or in the .
Sorry, it is here: Basically you need to do and this should do the trick. Considering that we are going to use this in more than one place it probably makes sense to introduce it as a , but the result is the same regardless.
Oh that's a neat trick! I'll try that approach out next. Thank you so much! I tried out the extra-plugins approach here, seems to work but is not ergonomic:
I , and it's a lot easier to use as a user! If it looks good as an approach, please provide some review feedback and I'll squash it down for a PR :)
Shall I send a PR for a final review?

Discussion:
, qtmultimedia , qtx11extras , soxr <ins> , vgmstream </ins> , wavpack }:

dontWrapQtApps = true; <ins> postInstall = '' ln -s ${vgmstream.override { buildAudaciousPlugin = true; }}/lib/audacious/Input/* $out/lib/audacious/Input ''; </ins> meta = audacious.meta // { description = "Plugins for Audacious music player"; };

<del> { stdenv, lib, fetchFromGitHub, cmake, pkg-config , mpg123, ffmpeg, libvorbis, libao, jansson, speex </del> <ins> { stdenv, lib, fetchFromGitHub, cmake, pkg-config, gtk3 , audacious, mpg123, ffmpeg, libvorbis, libao, jansson, speex </ins> , nix-update-script <ins> , buildAudaciousPlugin ? false  # only build cli by default, pkgs.audacious-plugins sets this to enable plugin support </ins> }: stdenv.mkDerivation rec {

extraArgs = [ "--version-regex" "r(.*)" ]; }; <del> nativeBuildInputs = [ cmake pkg-config ]; </del> <ins> nativeBuildInputs = [ cmake pkg-config ] ++ lib.optional buildAudaciousPlugin gtk3; </ins> <del> buildInputs = [ mpg123 ffmpeg libvorbis libao jansson speex ]; </del> <ins> 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")" ''; </ins> cmakeFlags = [ <del> # There's no nice way to build the audacious plugin without a circular dependency "-DBUILD_AUDACIOUS=OFF" </del> # It always tries to download it, no option to use the system one "-DUSE_CELT=OFF" <del> ]; </del> <ins> ] ++ lib.optional (! buildAudaciousPlugin) "-DBUILD_AUDACIOUS=OFF"; </ins> meta = with lib; { description = "A library for playback of various streamed audio formats used in video games";