Building alsa-utils for headless system (without GUI dependencies)

Hi everyone,

I recently started exploring NixOS for running a headless Raspberry Pi 5. This is has been very interesting and exciting. However, I have run into a problem, which I don’t know how to surpass:

Building alsa-utils seem to have a couple of GUI related dependencies, e.g. wayland and gtk4. As I need to either cross-compile from my laptop or build on my pi, I would prefer not build these dependencies, as it takes a long time, and eventually should not be necessary for any of the utilities I intend to use.

After exploring the dependency tree, I have found out that the issue possibly stems from alsa-plugins-1.2.12 needing the full ffmpeg-8.0 (and not just ffmpeg-headless-8.0). This leads to my question:

Is it possible somehow to override alsa-utils to not install alsa-plugins? If so, how would this be done? Do I need to patch the alsa-utils package somehow or is there a simpler way?

You could override postFixup since that’s where the plugins get used:

I don’t know enough about the package to know if removing the dependency on alsa-plugins is the right move, though. Do you need alsa at all?

Thanks. Using

environment.systemPackages = with pkgs; [
  (alsa-utils.overrideAttrs (oldAttrs: {
    postFixup = ''
      mv $out/bin/alsa-info.sh $out/bin/alsa-info
      wrapProgram $out/bin/alsa-info --prefix PATH : "${
        lib.makeBinPath [
          which
          pciutils
          procps
          tree
        ]
      }" --prefix PATH : $out/bin
    '';
  }))
];

solved the issue.