NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.91k stars 13.95k forks source link

`cava`: Cava is built without SDL and OpenGL Support #320129

Closed 0x50F1A closed 4 months ago

0x50F1A commented 4 months ago

Describe the bug

Per the Cava Config File, cava should be able to output to a graphical context, for desktop instead of terminal usage:

Output method. Can be 'ncurses', 'noncurses', 'raw', 'noritake', 'sdl' or 'sdl_glsl'. 'noncurses' (default) uses a buffer and cursor movements to only print changes from frame to frame in the terminal. Uses less resources and is less prone to tearing (vsync issues) than 'ncurses'. 'raw' is an 8 or 16 bit (configurable via the 'bit_format' option) data stream of the bar heights that can be used to send to other applications. 'raw' defaults to 200 bars, which can be adjusted in the 'bars' option above. 'noritake' outputs a bitmap in the format expected by a Noritake VFD display in graphic mode. It only support the 3000 series graphical VFDs for now. 'sdl' uses the Simple DirectMedia Layer to render in a graphical context. 'sdl_glsl' uses SDL to create an OpenGL context. Write your own shaders or use one of the predefined ones.

However, the nixpkgs distribution of cava seems to not build opengl support:

-> cava
Error loading config. cava was built without opengl support, install opengl dev files and run make clean && ./configure && make again

It is also built without SDL support:

-> cava
Error loading config. cava was built without sdl support, install sdl dev files and run make clean && ./configure && make again

Steps To Reproduce

Steps to reproduce the behavior:

  1. environment.systemPackages = [pkgs.cava];
  2. Add:
    [output]
    method = sdl_glsl 

    or method = sdl to the config file

  3. Run cava

Expected behavior

Cava should launch into a graphical context

Notify maintainers

@offline @mirrexagon

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

 - system: `"x86_64-linux"`
 - host os: `Linux 6.9.3-zen1, NixOS, 24.11 (Vicuña), 24.11.20240612.57d6973`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Lix, like Nix) 2.90.0-beta.1`
 - nixpkgs: `/nix/store/8x9z340mjwkv8l4fszz8ng1fl681pi7r-dydg48djlykksz8cxq0xjplyxpa9pvf4-source`

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

matteo-pacini commented 4 months ago

@0x50F1A cava has an attribute to include both SDL2 and OpenGL apparently,

i.e. cava.override { withSDL2 = true; }

0x50F1A commented 4 months ago

@0x50F1A cava has an attribute to include both SDL2 and OpenGL apparently,

i.e. cava.override { withSDL2 = true; }

image

Perfect, thank you!

ForceConstant commented 3 months ago

@0x50F1A cava has an attribute to include both SDL2 and OpenGL apparently,

i.e. cava.override { withSDL2 = true; }

Can you explain where to use this option? As I don't actually see it as part of cava.

matteo-pacini commented 3 months ago

@ForceConstant that's not an option within cava itself, but rather a "derivation flag": https://github.com/NixOS/nixpkgs/blob/nixos-24.05/pkgs/applications/audio/cava/default.nix#L15

cava.override { withSDL2 = true; } returns another derivation where the withSDL2 flag is set true. That in turn, builds the SDL2 support into cava.

You can test it in a REPL:

nix repl
:l <nixpkgs> 

Then you can run

:b (cava.override { withSDL2 = true; })

The resulting store path will contain cava + SDL2 support.

In short, just replace cava with (cava.override { withSDL2 = true; }) in your Nix configs to make sure it's built with SDL2 support.