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 sticker_file "${cfg.dataDir}/sticker.sql" 17 log_file "syslog" 18 user "mpd" 19 ${cfg.extraConfig} 20 - ''; 21 22 in { 23 24 ###### interface 25 26 - options = { 27 28 - services.mpd = { 29 30 enable = mkOption { 31 default = false; 32 description = '' 33 Whether to enable MPD, the music player daemon. 34 - ''; 35 - }; 36 37 musicDirectory = mkOption { 38 default = "${cfg.dataDir}/music"; 39 description = '' 40 Extra configuration added to the end of MPD's 41 configuration file, mpd.conf. 42 - ''; 43 - }; 44 45 extraConfig = mkOption { 46 - default = ""; 47 description = '' 48 Extra directives added to to the end of MPD's configuration file, 49 mpd.conf. Basic configuration like file location and uid/gid 50 is added automatically to the beginning of the file. 51 - ''; 52 - }; 53 54 dataDir = mkOption { 55 default = "/var/lib/mpd"; 56 description = '' 57 The directory where MPD stores its state, tag cache, 58 playlists etc. 59 - ''; 60 - }; 61 62 - }; 63 64 - }; 65 66 67 ###### implementation
··· 16 sticker_file "${cfg.dataDir}/sticker.sql" 17 log_file "syslog" 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 ""} 23 ${cfg.extraConfig} 24 + ''; 25 26 in { 27 28 ###### interface 29 30 + options = { 31 32 + services.mpd = { 33 34 enable = mkOption { 35 default = false; 36 description = '' 37 Whether to enable MPD, the music player daemon. 38 + ''; 39 + }; 40 41 musicDirectory = mkOption { 42 default = "${cfg.dataDir}/music"; 43 description = '' 44 Extra configuration added to the end of MPD's 45 configuration file, mpd.conf. 46 + ''; 47 + }; 48 49 extraConfig = mkOption { 50 + default = ""; 51 description = '' 52 Extra directives added to to the end of MPD's configuration file, 53 mpd.conf. Basic configuration like file location and uid/gid 54 is added automatically to the beginning of the file. 55 + ''; 56 + }; 57 58 dataDir = mkOption { 59 default = "/var/lib/mpd"; 60 description = '' 61 The directory where MPD stores its state, tag cache, 62 playlists etc. 63 + ''; 64 + }; 65 66 + network = { 67 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 + }; 89 90 91 ###### implementation