diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 73a61c4ca0e7..1ee4b4e88a9d 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -364,6 +364,7 @@ ./services/desktops/malcontent.nix ./services/desktops/pipewire/pipewire.nix ./services/desktops/pipewire/pipewire-media-session.nix + ./services/desktops/pipewire/wireplumber.nix ./services/desktops/gnome/at-spi2-core.nix ./services/desktops/gnome/chrome-gnome-shell.nix ./services/desktops/gnome/evolution-data-server.nix diff --git a/nixos/modules/services/desktops/pipewire/wireplumber.nix b/nixos/modules/services/desktops/pipewire/wireplumber.nix new file mode 100644 index 000000000000..ad96dc1f9745 --- /dev/null +++ b/nixos/modules/services/desktops/pipewire/wireplumber.nix @@ -0,0 +1,41 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.services.pipewire.wireplumber; +in +{ + meta.maintainers = [ lib.maintainers.k900 ]; + + options = { + services.pipewire.wireplumber = { + enable = lib.mkEnableOption "A modular session / policy manager for PipeWire"; + + package = lib.mkOption { + type = lib.types.package; + default = pkgs.wireplumber; + defaultText = lib.literalExpression "pkgs.wireplumber"; + description = '' + The wireplumber derivation to use. + ''; + }; + }; + }; + + config = lib.mkIf cfg.enable { + assertions = [ + { + assertion = !config.services.pipewire.media-session.enable; + message = "WirePlumber and pipewire-media-session can't be enabled at the same time."; + } + ]; + + environment.systemPackages = [ cfg.package ]; + systemd.packages = [ cfg.package ]; + + systemd.services.wireplumber.enable = config.services.pipewire.systemWide; + systemd.user.services.wireplumber.enable = !config.services.pipewire.systemWide; + + systemd.services.wireplumber.wantedBy = [ "pipewire.service" ]; + systemd.user.services.wireplumber.wantedBy = [ "pipewire.service" ]; + }; +}