pulseaudio: Add pulse-access group, controlling access to the system-wide PA daemon
This commit is contained in:
parent
c4494144fd
commit
56102642fa
@ -10,10 +10,12 @@ let
|
|||||||
systemWide = cfg.enable && cfg.systemWide;
|
systemWide = cfg.enable && cfg.systemWide;
|
||||||
nonSystemWide = cfg.enable && !cfg.systemWide;
|
nonSystemWide = cfg.enable && !cfg.systemWide;
|
||||||
|
|
||||||
uid = config.ids.uids.pulseaudio;
|
ids = config.ids;
|
||||||
gid = config.ids.gids.pulseaudio;
|
|
||||||
|
|
||||||
stateDir = "/run/pulse";
|
uid = ids.uids.pulseaudio;
|
||||||
|
gid = ids.gids.pulseaudio;
|
||||||
|
|
||||||
|
stateDir = "/var/run/pulse";
|
||||||
|
|
||||||
# Create pulse/client.conf even if PulseAudio is disabled so
|
# Create pulse/client.conf even if PulseAudio is disabled so
|
||||||
# that we can disable the autospawn feature in programs that
|
# that we can disable the autospawn feature in programs that
|
||||||
@ -138,19 +140,24 @@ in {
|
|||||||
group = "pulse";
|
group = "pulse";
|
||||||
extraGroups = [ "audio" ];
|
extraGroups = [ "audio" ];
|
||||||
description = "PulseAudio system service user";
|
description = "PulseAudio system service user";
|
||||||
|
home = stateDir;
|
||||||
|
createHome = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
users.extraGroups.pulse.gid = gid;
|
users.extraGroups.pulse.gid = gid;
|
||||||
|
|
||||||
|
users.extraGroups.pulse-access = {
|
||||||
|
gid = ids.gids.pulse-access;
|
||||||
|
members = with builtins; config.users.extraGroups.audio.members ++ (
|
||||||
|
attrNames(filterAttrs (n: u: elem "audio" u.extraGroups) config.users.extraUsers)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
systemd.services.pulseaudio = {
|
systemd.services.pulseaudio = {
|
||||||
description = "PulseAudio System-Wide Server";
|
description = "PulseAudio System-Wide Server";
|
||||||
wantedBy = [ "sound.target" ];
|
wantedBy = [ "sound.target" ];
|
||||||
before = [ "sound.target" ];
|
before = [ "sound.target" ];
|
||||||
environment.PULSE_RUNTIME_PATH = stateDir;
|
environment.PULSE_RUNTIME_PATH = stateDir;
|
||||||
preStart = ''
|
|
||||||
mkdir -p --mode 755 ${stateDir}
|
|
||||||
chown -R pulse:pulse ${stateDir}
|
|
||||||
'';
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = "${cfg.package}/bin/pulseaudio -D --log-level=${cfg.daemon.logLevel} --system --use-pid-file -n --file=${cfg.configFile}";
|
ExecStart = "${cfg.package}/bin/pulseaudio -D --log-level=${cfg.daemon.logLevel} --system --use-pid-file -n --file=${cfg.configFile}";
|
||||||
PIDFile = "${stateDir}/pid";
|
PIDFile = "${stateDir}/pid";
|
||||||
|
@ -270,6 +270,7 @@
|
|||||||
riemann = 137;
|
riemann = 137;
|
||||||
riemanndash = 138;
|
riemanndash = 138;
|
||||||
uhub = 142;
|
uhub = 142;
|
||||||
|
pulse-access = 143;
|
||||||
|
|
||||||
# When adding a gid, make sure it doesn't match an existing uid. And don't use gids above 399!
|
# When adding a gid, make sure it doesn't match an existing uid. And don't use gids above 399!
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user