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.
This commit is contained in:
parent
f3bf0f173e
commit
f54612264e
@ -36,6 +36,8 @@ let
|
|||||||
${addModuleIf cfg.zeroconf.discovery.enable "module-zeroconf-discover"}
|
${addModuleIf cfg.zeroconf.discovery.enable "module-zeroconf-discover"}
|
||||||
${addModuleIf cfg.tcp.enable (concatStringsSep " "
|
${addModuleIf cfg.tcp.enable (concatStringsSep " "
|
||||||
([ "module-native-protocol-tcp" ] ++ allAnon ++ ipAnon))}
|
([ "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}
|
${cfg.extraConfig}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
@ -144,7 +146,9 @@ in {
|
|||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
default = pkgs.pulseaudio;
|
default = if config.services.jack.jackd.enable
|
||||||
|
then pkgs.pulseaudioFull
|
||||||
|
else pkgs.pulseaudio;
|
||||||
defaultText = "pkgs.pulseaudio";
|
defaultText = "pkgs.pulseaudio";
|
||||||
example = literalExample "pkgs.pulseaudioFull";
|
example = literalExample "pkgs.pulseaudioFull";
|
||||||
description = ''
|
description = ''
|
||||||
@ -284,6 +288,8 @@ in {
|
|||||||
RestartSec = "500ms";
|
RestartSec = "500ms";
|
||||||
PassEnvironment = "DISPLAY";
|
PassEnvironment = "DISPLAY";
|
||||||
};
|
};
|
||||||
|
} // optionalAttrs config.services.jack.jackd.enable {
|
||||||
|
environment.JACK_PROMISCUOUS_SERVER = "jackaudio";
|
||||||
};
|
};
|
||||||
sockets.pulseaudio = {
|
sockets.pulseaudio = {
|
||||||
wantedBy = [ "sockets.target" ];
|
wantedBy = [ "sockets.target" ];
|
||||||
|
@ -246,6 +246,9 @@ in {
|
|||||||
description = "JACK Audio Connection Kit";
|
description = "JACK Audio Connection Kit";
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
User = "jackaudio";
|
User = "jackaudio";
|
||||||
|
SupplementaryGroups = lib.optional
|
||||||
|
(config.hardware.pulseaudio.enable
|
||||||
|
&& !config.hardware.pulseaudio.systemWide) "users";
|
||||||
ExecStart = "${cfg.jackd.package}/bin/jackd ${lib.escapeShellArgs cfg.jackd.extraOptions}";
|
ExecStart = "${cfg.jackd.package}/bin/jackd ${lib.escapeShellArgs cfg.jackd.extraOptions}";
|
||||||
LimitRTPRIO = 99;
|
LimitRTPRIO = 99;
|
||||||
LimitMEMLOCK = "infinity";
|
LimitMEMLOCK = "infinity";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user