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