···16 sticker_file "${cfg.dataDir}/sticker.sql"
17 log_file "syslog"
18 user "mpd"
000019 ${cfg.extraConfig}
20- '';
2122in {
2324 ###### interface
2526- options = {
2728- services.mpd = {
2930 enable = mkOption {
31 default = false;
32 description = ''
33 Whether to enable MPD, the music player daemon.
34- '';
35- };
3637 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- };
4445 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- };
5354 dataDir = mkOption {
55 default = "/var/lib/mpd";
56 description = ''
57 The directory where MPD stores its state, tag cache,
58 playlists etc.
59- '';
60- };
6162- };
6364- };
00000000000000000000656667 ###### 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+ '';
2526in {
2728 ###### interface
2930+ options = {
3132+ services.mpd = {
3334 enable = mkOption {
35 default = false;
36 description = ''
37 Whether to enable MPD, the music player daemon.
38+ '';
39+ };
4041 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+ };
4849 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+ };
5758 dataDir = mkOption {
59 default = "/var/lib/mpd";
60 description = ''
61 The directory where MPD stores its state, tag cache,
62 playlists etc.
63+ '';
64+ };
6566+ network = {
6768+ 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+ };
899091 ###### implementation