Fix shairport-sync module to create and set an explicit group
This commit is contained in:
parent
2a295f42c8
commit
c23851c47e
@ -53,6 +53,15 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
group = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "shairport";
|
||||||
|
description = ''
|
||||||
|
Group account name under which to run shairport-sync. The account
|
||||||
|
will be created.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -66,14 +75,17 @@ in
|
|||||||
services.avahi.publish.enable = true;
|
services.avahi.publish.enable = true;
|
||||||
services.avahi.publish.userServices = true;
|
services.avahi.publish.userServices = true;
|
||||||
|
|
||||||
users.users.${cfg.user} =
|
users = {
|
||||||
{ description = "Shairport user";
|
users.${cfg.user} = {
|
||||||
|
description = "Shairport user";
|
||||||
isSystemUser = true;
|
isSystemUser = true;
|
||||||
createHome = true;
|
createHome = true;
|
||||||
home = "/var/lib/shairport-sync";
|
home = "/var/lib/shairport-sync";
|
||||||
|
group = cfg.group;
|
||||||
extraGroups = [ "audio" ] ++ optional config.hardware.pulseaudio.enable "pulse";
|
extraGroups = [ "audio" ] ++ optional config.hardware.pulseaudio.enable "pulse";
|
||||||
};
|
};
|
||||||
|
groups.${cfg.group} = {};
|
||||||
|
};
|
||||||
|
|
||||||
networking.firewall = mkIf cfg.openFirewall {
|
networking.firewall = mkIf cfg.openFirewall {
|
||||||
allowedTCPPorts = [ 5000 ];
|
allowedTCPPorts = [ 5000 ];
|
||||||
@ -87,6 +99,7 @@ in
|
|||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
User = cfg.user;
|
User = cfg.user;
|
||||||
|
Group = cfg.group;
|
||||||
ExecStart = "${pkgs.shairport-sync}/bin/shairport-sync ${cfg.arguments}";
|
ExecStart = "${pkgs.shairport-sync}/bin/shairport-sync ${cfg.arguments}";
|
||||||
RuntimeDirectory = "shairport-sync";
|
RuntimeDirectory = "shairport-sync";
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user