diff options
author | K900 <me@0upti.me> | 2024-02-26 10:04:45 +0300 |
---|---|---|
committer | K900 <me@0upti.me> | 2024-02-26 10:04:45 +0300 |
commit | eb74747f38d83f83aa6aace76e3f76a76194b081 (patch) | |
tree | 9e333d5487ca775a048c72d729075d7340f94558 /nixos/modules/services/desktops | |
parent | fd5473b6f30954fa335092d8e264ba5c493e8c0c (diff) |
nixos/pipewire: add LV2 plugins option
Follow-up #282377.
Some packages may want to load LV2 plugins directly from PipeWire config instead, so add another option to accomodate those.
Diffstat (limited to 'nixos/modules/services/desktops')
-rw-r--r-- | nixos/modules/services/desktops/pipewire/pipewire.nix | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/nixos/modules/services/desktops/pipewire/pipewire.nix b/nixos/modules/services/desktops/pipewire/pipewire.nix index 238259c212bb..aa24c0842bab 100644 --- a/nixos/modules/services/desktops/pipewire/pipewire.nix +++ b/nixos/modules/services/desktops/pipewire/pipewire.nix @@ -43,6 +43,21 @@ let ++ lib.optionals cfg.wireplumber.enable cfg.wireplumber.configPackages; pathsToLink = [ "/share/pipewire" ]; }; + + requiredLv2Packages = lib.flatten + ( + lib.concatMap + (p: + lib.attrByPath ["passthru" "requiredLv2Packages"] [] p + ) + configPackages + ); + + lv2Plugins = pkgs.buildEnv { + name = "pipewire-lv2-plugins"; + paths = cfg.extraLv2Packages ++ requiredLv2Packages; + pathsToLink = [ "/lib/lv2" ]; + }; in { meta.maintainers = teams.freedesktop.members ++ [ lib.maintainers.k900 ]; @@ -233,6 +248,21 @@ in { `share/pipewire/*/*.conf` files. ''; }; + + extraLv2Packages = lib.mkOption { + type = lib.types.listOf lib.types.package; + default = []; + example = lib.literalExpression "[ pkgs.lsp-plugins ]"; + description = lib.mdDoc '' + List of packages that provide LV2 plugins in `lib/lv2` that should + be made available to PipeWire for [filter chains][wiki-filter-chain]. + + Config packages have their required LV2 plugins added automatically, + so they don't need to be specified here. + + [wiki-filter-chain]: https://docs.pipewire.org/page_module_filter_chain.html + ''; + }; }; }; @@ -282,6 +312,9 @@ in { systemd.user.sockets.pipewire.enable = !cfg.systemWide; systemd.user.services.pipewire.enable = !cfg.systemWide; + systemd.services.pipewire.environment.LV2_PATH = lib.mkIf cfg.systemWide "${lv2Plugins}/lib/lv2"; + systemd.user.services.pipewire.environment.LV2_PATH = lib.mkIf (!cfg.systemWide) "${lv2Plugins}/lib/lv2"; + # Mask pw-pulse if it's not wanted systemd.user.services.pipewire-pulse.enable = cfg.pulse.enable; systemd.user.sockets.pipewire-pulse.enable = cfg.pulse.enable; |