roon-server: Add actual user piping

Adds defined IDs
This commit is contained in:
Alex Guzman 2019-08-07 12:27:52 -07:00
parent 8becc897ea
commit 62d242d1cd
2 changed files with 28 additions and 1 deletions

View File

@ -340,6 +340,7 @@
cockroachdb = 313; cockroachdb = 313;
zoneminder = 314; zoneminder = 314;
paperless = 315; paperless = 315;
roon-server = 316;
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399! # When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
@ -640,6 +641,7 @@
cockroachdb = 313; cockroachdb = 313;
zoneminder = 314; zoneminder = 314;
paperless = 315; paperless = 315;
roon-server = 316;
# When adding a gid, make sure it doesn't match an existing # When adding a gid, make sure it doesn't match an existing
# uid. Users and groups with the same name should have equal # uid. Users and groups with the same name should have equal

View File

@ -19,6 +19,20 @@ in {
TCP: 9100 - 9200 TCP: 9100 - 9200
''; '';
}; };
user = mkOption {
type = types.string;
default = "roon-server";
description = ''
User to run the Roon Server as.
'';
};
group = mkOption {
type = types.string;
default = "roon-server";
description = ''
Group to run the Roon Server as.
'';
};
}; };
}; };
@ -33,7 +47,7 @@ in {
serviceConfig = { serviceConfig = {
ExecStart = "${pkgs.roon-server}/opt/start.sh"; ExecStart = "${pkgs.roon-server}/opt/start.sh";
LimitNOFILE = 8192; LimitNOFILE = 8192;
SupplementaryGroups = "audio"; User = cfg.user;
}; };
}; };
@ -43,5 +57,16 @@ in {
]; ];
allowedUDPPorts = [ 9003 ]; allowedUDPPorts = [ 9003 ];
}; };
users.groups = singleton {
name = cfg.group;
gid = config.ids.gids.roon-server;
};
users.users = singleton {
name = cfg.user;
description = "Roon Server user";
uid = config.ids.uids.roon-server;
groups = [ cfg.group "audio" ];
};
}; };
} }