3
0
Fork 0
forked from mirrors/nixpkgs

modules/mpd: factor out name & mention man 5 mpd.conf

This commit is contained in:
Profpatsch 2017-02-16 01:17:44 +01:00
parent 31dac10c33
commit 2b0469c48f

View file

@ -4,6 +4,8 @@ with lib;
let
name = "mpd";
uid = config.ids.uids.mpd;
gid = config.ids.gids.mpd;
cfg = config.services.mpd;
@ -54,13 +56,14 @@ in {
description = ''
Extra directives added to to the end of MPD's configuration file,
mpd.conf. Basic configuration like file location and uid/gid
is added automatically to the beginning of the file.
is added automatically to the beginning of the file. For available
options see <literal>man 5 mpd.conf</literal>'.
'';
};
dataDir = mkOption {
type = types.path;
default = "/var/lib/mpd";
default = "/var/lib/${name}";
description = ''
The directory where MPD stores its state, tag cache,
playlists etc.
@ -69,13 +72,13 @@ in {
user = mkOption {
type = types.str;
default = "mpd";
default = name;
description = "User account under which MPD runs.";
};
group = mkOption {
type = types.str;
default = "mpd";
default = name;
description = "Group account under which MPD runs.";
};
@ -131,17 +134,17 @@ in {
};
};
users.extraUsers = optionalAttrs (cfg.user == "mpd") (singleton {
users.extraUsers = optionalAttrs (cfg.user == name) (singleton {
inherit uid;
name = "mpd";
inherit name;
group = cfg.group;
extraGroups = [ "audio" ];
description = "Music Player Daemon user";
home = "${cfg.dataDir}";
});
users.extraGroups = optionalAttrs (cfg.group == "mpd") (singleton {
name = "mpd";
users.extraGroups = optionalAttrs (cfg.group == name) (singleton {
inherit name;
gid = gid;
});
};