From 2b0469c48f3211425ed06ae3ee5f257f97d9753c Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Thu, 16 Feb 2017 01:17:44 +0100 Subject: modules/mpd: factor out name & mention man 5 mpd.conf --- nixos/modules/services/audio/mpd.nix | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'nixos/modules/services/audio/mpd.nix') diff --git a/nixos/modules/services/audio/mpd.nix b/nixos/modules/services/audio/mpd.nix index a89215d7382..56af8fe152e 100644 --- a/nixos/modules/services/audio/mpd.nix +++ b/nixos/modules/services/audio/mpd.nix @@ -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 man 5 mpd.conf'. ''; }; 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; }); }; -- cgit 1.4.1