mpd service: add network.{host,port} options

Closes #4084

authored by Dmitry Malikov and committed by Mateusz Kowalczyk 08cc8da6 2db5d952

+38 -14
+38 -14
nixos/modules/services/audio/mpd.nix
··· 16 16 sticker_file "${cfg.dataDir}/sticker.sql" 17 17 log_file "syslog" 18 18 user "mpd" 19 + ${if cfg.network.host != "any" then 20 + "bind_to_address ${cfg.network.host}" else ""} 21 + ${if cfg.network.port != 6600 then 22 + "port ${cfg.network.port.toString()}" else ""} 19 23 ${cfg.extraConfig} 20 - ''; 24 + ''; 21 25 22 26 in { 23 27 24 28 ###### interface 25 29 26 - options = { 30 + options = { 27 31 28 - services.mpd = { 32 + services.mpd = { 29 33 30 34 enable = mkOption { 31 35 default = false; 32 36 description = '' 33 37 Whether to enable MPD, the music player daemon. 34 - ''; 35 - }; 38 + ''; 39 + }; 36 40 37 41 musicDirectory = mkOption { 38 42 default = "${cfg.dataDir}/music"; 39 43 description = '' 40 44 Extra configuration added to the end of MPD's 41 45 configuration file, mpd.conf. 42 - ''; 43 - }; 46 + ''; 47 + }; 44 48 45 49 extraConfig = mkOption { 46 - default = ""; 50 + default = ""; 47 51 description = '' 48 52 Extra directives added to to the end of MPD's configuration file, 49 53 mpd.conf. Basic configuration like file location and uid/gid 50 54 is added automatically to the beginning of the file. 51 - ''; 52 - }; 55 + ''; 56 + }; 53 57 54 58 dataDir = mkOption { 55 59 default = "/var/lib/mpd"; 56 60 description = '' 57 61 The directory where MPD stores its state, tag cache, 58 62 playlists etc. 59 - ''; 60 - }; 63 + ''; 64 + }; 61 65 62 - }; 66 + network = { 63 67 64 - }; 68 + host = mkOption { 69 + default = "any"; 70 + description = '' 71 + This setting sets the address for the daemon to listen on. Careful attention 72 + should be paid if this is assigned to anything other then the default, any. 73 + This setting can deny access to control of the daemon. 74 + ''; 75 + }; 76 + 77 + port = mkOption { 78 + default = 6600; 79 + description = '' 80 + This setting is the TCP port that is desired for the daemon to get assigned 81 + to. 82 + ''; 83 + }; 84 + 85 + }; 86 + }; 87 + 88 + }; 65 89 66 90 67 91 ###### implementation