NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.15k stars 14.18k forks source link

audacious plugins are hard to extend, causing infinite recursion #303143

Closed hufman closed 6 months ago

hufman commented 7 months ago

Describe the bug

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 audacious output disabled, because importing the audacious package causes an infinite recursion error.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Add vgmstream to audacious-plugins buildInputs
  2. Add audacious to vgmstream's buildInputs and comment out the disable configure flag
  3. nix-shell -p audacious-plugins

Expected behavior

I expected that adding vgmstream to audacious-plugins would enable the plugin.

Screenshots

Instead, the build crashes with an infinite recursion.

Additional context

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 guide 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?

Notify maintainers

@eelco @RamKromberg @ttuegel @thiagokokada

Metadata

hufman@nixos:/build_tmp/nixpkgs/pkgs/applications/audio/audacious$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"aarch64-linux"`
 - host os: `Linux 5.10.66, NixOS, 23.11 (Tapir), 23.11.20231129.50aa30a`
 - multi-user?: `no`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - channels(hufman): `"home-manager-23.05.tar.gz"`
 - channels(root): `"nixos-23.11, nixos-23.11-23.11"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Add a :+1: reaction to issues you find important.

thiagokokada commented 7 months ago

Instead of adding audacious, did you try to add audaciouaBare instead?

audaciousBare is audacious without audacious-plugins as input, and it is used to break the loop.

hufman commented 7 months ago

Thank you for the quick response! That would be elegant, but I don't see any audaciousBare result in my grep of nixpkgs or in the package index.

thiagokokada commented 7 months ago

Thank you for the quick response! That would be elegant, but I don't see any audaciousBare result in my grep of nixpkgs or in the package index.

Sorry, it is here: https://github.com/NixOS/nixpkgs/blob/a90b106c96d70cbd9ff53cfa0f8a8a6612e96c36/pkgs/top-level/all-packages.nix#L29932-L29935

Basically you need to do audacious.override { audacious-plugins = null; }; 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 audacious-bare, but the result is the same regardless.

hufman commented 7 months ago

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: https://github.com/NixOS/nixpkgs/commit/7135180b6ed34868121bbfa57e484b998b2609d3

hufman commented 7 months ago

I drafted up the audacious-without-plugins approach, 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 :)

hufman commented 7 months ago

Shall I send a PR for a final review?