git.iko.soy/typeable/nixpkgs
on master help sign in
modules/mpd: factor out name & mention man 5 mpd.conf
commit2b0469c48f3211425ed06ae3ee5f257f97d9753c authorProfpatsch <mail@profpatsch.de> dateThu 16 Feb 2017, 01:17 (10 years ago) parent31dac10
1 file changed+11−8
nixos/modules/services/audio/mpd.nix+11−8
nixos/modules/services/audio/mpd.nix+11−8
@@ -4,6 +4,8 @@ with lib;
44
55let
66
7+ name = "mpd";
8+
79 uid = config.ids.uids.mpd;
810 gid = config.ids.gids.mpd;
911 cfg = config.services.mpd;
@@ -54,13 +56,14 @@ in {
5456 description = ''
5557 Extra directives added to to the end of MPD's configuration file,
5658 mpd.conf. Basic configuration like file location and uid/gid
57− is added automatically to the beginning of the file.
59+ is added automatically to the beginning of the file. For available
60+ options see <literal>man 5 mpd.conf</literal>'.
5861 '';
5962 };
6063
6164 dataDir = mkOption {
6265 type = types.path;
63− default = "/var/lib/mpd";
66+ default = "/var/lib/${name}";
6467 description = ''
6568 The directory where MPD stores its state, tag cache,
6669 playlists etc.
@@ -69,13 +72,13 @@ in {
6972
7073 user = mkOption {
7174 type = types.str;
72− default = "mpd";
75+ default = name;
7376 description = "User account under which MPD runs.";
7477 };
7578
7679 group = mkOption {
7780 type = types.str;
78− default = "mpd";
81+ default = name;
7982 description = "Group account under which MPD runs.";
8083 };
8184
@@ -131,17 +134,17 @@ in {
131134 };
132135 };
133136
134− users.extraUsers = optionalAttrs (cfg.user == "mpd") (singleton {
137+ users.extraUsers = optionalAttrs (cfg.user == name) (singleton {
135138 inherit uid;
136− name = "mpd";
139+ inherit name;
137140 group = cfg.group;
138141 extraGroups = [ "audio" ];
139142 description = "Music Player Daemon user";
140143 home = "${cfg.dataDir}";
141144 });
142145
143− users.extraGroups = optionalAttrs (cfg.group == "mpd") (singleton {
144− name = "mpd";
146+ users.extraGroups = optionalAttrs (cfg.group == name) (singleton {
147+ inherit name;
145148 gid = gid;
146149 });
147150 };