]>
Commit | Line | Data |
---|---|---|
1 | { lib, pkgs, config, ... }: | |
2 | { | |
3 | options.myServices.mpd.enable = lib.mkEnableOption "enable MPD"; | |
4 | config = lib.mkIf config.myServices.mpd.enable { | |
5 | services.duplyBackup.profiles.mpd = { | |
6 | rootDir = "/var/lib/mpd"; | |
7 | }; | |
8 | secrets.keys = [ | |
9 | { | |
10 | dest = "mpd"; | |
11 | permissions = "0400"; | |
12 | text = config.myEnv.mpd.password; | |
13 | } | |
14 | { | |
15 | dest = "mpd-config"; | |
16 | permissions = "0400"; | |
17 | user = "mpd"; | |
18 | group = "mpd"; | |
19 | text = '' | |
20 | password "${config.myEnv.mpd.password}@read,add,control,admin" | |
21 | ''; | |
22 | } | |
23 | ]; | |
24 | networking.firewall.allowedTCPPorts = [ 6600 ]; | |
25 | users.users.mpd.extraGroups = [ "wwwrun" "keys" ]; | |
26 | systemd.services.mpd.serviceConfig.RuntimeDirectory = "mpd"; | |
27 | services.filesWatcher.mpd = { | |
28 | restart = true; | |
29 | paths = [ "/var/secrets/mpd-config" ]; | |
30 | }; | |
31 | ||
32 | services.mpd = { | |
33 | enable = true; | |
34 | network.listenAddress = "any"; | |
35 | musicDirectory = config.myEnv.mpd.folder; | |
36 | extraConfig = '' | |
37 | include "/var/secrets/mpd-config" | |
38 | audio_output { | |
39 | type "null" | |
40 | name "No Output" | |
41 | mixer_type "none" | |
42 | } | |
43 | audio_output { | |
44 | type "httpd" | |
45 | name "OGG" | |
46 | encoder "vorbis" | |
47 | bind_to_address "/run/mpd/ogg.sock" | |
48 | quality "5.0" | |
49 | format "44100:16:1" | |
50 | } | |
51 | audio_output { | |
52 | type "httpd" | |
53 | name "MP3" | |
54 | encoder "lame" | |
55 | bind_to_address "/run/mpd/mp3.sock" | |
56 | quality "5.0" | |
57 | format "44100:16:1" | |
58 | } | |
59 | ||
60 | ||
61 | ''; | |
62 | }; | |
63 | }; | |
64 | } | |
65 |