summary refs log tree commit diff
path: root/nixos/modules/config/pulseaudio.nix
diff options
context:
space:
mode:
authorRichard Marko <srk@48.io>2020-07-18 13:32:48 +0200
committerRichard Marko <srk@48.io>2020-09-08 08:44:20 +0200
commitf54612264edd7d743488e6469b5f774dbc07e7b7 (patch)
treeeb2330b2448d15b3d4dd7df7a4476f19791b7de4 /nixos/modules/config/pulseaudio.nix
parentf3bf0f173ec9b302c2613dfb6d76dc49b889f321 (diff)
downloadnixpkgs-f54612264edd7d743488e6469b5f774dbc07e7b7.tar
nixpkgs-f54612264edd7d743488e6469b5f774dbc07e7b7.tar.gz
nixpkgs-f54612264edd7d743488e6469b5f774dbc07e7b7.tar.bz2
nixpkgs-f54612264edd7d743488e6469b5f774dbc07e7b7.tar.lz
nixpkgs-f54612264edd7d743488e6469b5f774dbc07e7b7.tar.xz
nixpkgs-f54612264edd7d743488e6469b5f774dbc07e7b7.tar.zst
nixpkgs-f54612264edd7d743488e6469b5f774dbc07e7b7.zip
nixos/jack,pulseaudio: fix pulse connection to jackd service
This fixes the case when Jack Audio Daemon is running
as a service via `services.jack.jackd` and Pulseaudio
running as a *user* service.

Two issues prevented connecting `pulse` with `jackd`:
* Missing `JACK_PROMISCUOUS_SERVER` environment variable for `pulse` user service,
  resulting in `pulse` trying to access `jackd` as if it was running as part of
  the users session.
* `jackd` not being able to access socket created by `pulse` due to socket
  created using user ID and `users` group. Change allows `jackd` to access
  the socket created by `pulse` correctly.

`pulse` now also autoloads `module-jack-sink` and `module-jack-source`
if `services.jack.jackd.enable` is set.

The default `pulse` package is now set to `pulseaudioFull` automatically
if `services.jack.jackd.enable` is set.
Diffstat (limited to 'nixos/modules/config/pulseaudio.nix')
-rw-r--r--nixos/modules/config/pulseaudio.nix8
1 files changed, 7 insertions, 1 deletions
diff --git a/nixos/modules/config/pulseaudio.nix b/nixos/modules/config/pulseaudio.nix
index 408d0a9c33f..044fa48853d 100644
--- a/nixos/modules/config/pulseaudio.nix
+++ b/nixos/modules/config/pulseaudio.nix
@@ -36,6 +36,8 @@ let
         ${addModuleIf cfg.zeroconf.discovery.enable "module-zeroconf-discover"}
         ${addModuleIf cfg.tcp.enable (concatStringsSep " "
            ([ "module-native-protocol-tcp" ] ++ allAnon ++ ipAnon))}
+        ${addModuleIf config.services.jack.jackd.enable "module-jack-sink"}
+        ${addModuleIf config.services.jack.jackd.enable "module-jack-source"}
         ${cfg.extraConfig}
       '';
     };
@@ -144,7 +146,9 @@ in {
 
       package = mkOption {
         type = types.package;
-        default = pkgs.pulseaudio;
+        default = if config.services.jack.jackd.enable
+                  then pkgs.pulseaudioFull
+                  else pkgs.pulseaudio;
         defaultText = "pkgs.pulseaudio";
         example = literalExample "pkgs.pulseaudioFull";
         description = ''
@@ -284,6 +288,8 @@ in {
             RestartSec = "500ms";
             PassEnvironment = "DISPLAY";
           };
+        } // optionalAttrs config.services.jack.jackd.enable {
+          environment.JACK_PROMISCUOUS_SERVER = "jackaudio";
         };
         sockets.pulseaudio = {
           wantedBy = [ "sockets.target" ];