Asahi-audio on NixOS – LV2_PATH management

I’m currently trying to package asahi-audio for NixOS as cleanly as possible. asahi-audio itself is basically “only” a collection of config files for pipewire, wireplumber, and some adjacent WAV files for finite impulse response (FIR) filters fed into pipewire’s convolver.
For the config files I’ve already adapted the pipewire and wireplumber NixOS modules to also have a configPackages option from which config files are collected via lib.buildEnv and linked to /etc. I’m planning to try and upstream that some time soon.
What I’m currently still unsure about is the LV2_PATH. asahi-audio also uses two plugins that aren’t internal to pipewire, both LV2 plugins. I could just create a new asahi-audio NixOS module which takes care of setting the path in environment.sessionVariables, but that a) sets the path for everything, which IMO is not as clean as I’m used to from NixOS and b) requires a NixOS module or manual additions to that path for each further package like asahi-audio that deals with pipewire filter-chains using LV2 plugins.
What I’d want ideally would be to just add pkgs.asahi-audio to services.pipewire.wireplumber.configPackages and that’d be it. Currently when wireplumber is enabled, all wireplumber config packages also get included in the pipewire buildEnv, for convenience (the interest paths are set accordingly). So with that adding new packages like asahi-audio would be easy. Now my question is: How could I accomplish that?
Is there some way to specify and later collect all LV2 path requirements from dependencies so that those can be included in the LV2_PATH used by pipewire and pipewire only?

Note: LADSPA plugins can just be specified via their .so path, as far as I can tell this is not the case for LV2, as with LV2 there are also accompanying metadata files.
Note2: I’m packaging asahi-audio so I can fiddle with my (non-mac) laptop speakers to get them to sound better. I’ll therefore be poking around in those files quite a bit, but for your average user (for now only on macs) things should Just Work™ upon installation, which is why I would like installation to be clean.

You might be aware already, but just to be sure: the nixos-apple-silicon project has asahi-audio packaged. Their implementation of might be what you’re looking for?

Oh, I wasn’t aware of that project or that way of configuring systemd service environments, thanks! I did look for asahi-audio in the official nixpkgs repo, but since I didn’t find it there, I just went about packaging it myself. I did find a bankstown (one of the non-pipewire-internal plugins) PR just now from a person working on that project, just not for asahi-audio. Maybe I should look a bit harder next time.

I see that they use a passthru attribute in their package definition of asahi-audio to provide the config file paths for usage in the nixos module, maybe I can use that too for my approach with the LV2 dependencies.

I’ve now created nixos/pipewire: add configPackages options by hcsch · Pull Request #282377 · NixOS/nixpkgs · GitHub to upstream my changes to the pipewire and wireplumber NixOS modules. Thanks for pointing me in the right direction @autrimpo :slight_smile:

1 Like