]>
Commit | Line | Data |
---|---|---|
8a964143 | 1 | { lib, pkgs, config, myconfig, ... }: |
e229e6f2 | 2 | { |
8415083e IB |
3 | options.myServices.mpd.enable = lib.mkEnableOption "enable MPD"; |
4 | config = lib.mkIf config.myServices.mpd.enable { | |
d2e703c5 | 5 | services.duplyBackup.profiles.mpd = { |
6a8252b1 IB |
6 | rootDir = "/var/lib/mpd"; |
7 | }; | |
1a718805 | 8 | secrets.keys = [ |
742697c9 IB |
9 | { |
10 | dest = "mpd"; | |
914dd76c IB |
11 | permissions = "0400"; |
12 | text = myconfig.env.mpd.password; | |
742697c9 IB |
13 | } |
14 | { | |
15 | dest = "mpd-config"; | |
65e64925 IB |
16 | permissions = "0400"; |
17 | user = "mpd"; | |
18 | group = "mpd"; | |
19 | text = '' | |
20 | password "${myconfig.env.mpd.password}@read,add,control,admin" | |
21 | ''; | |
742697c9 IB |
22 | } |
23 | ]; | |
e229e6f2 | 24 | networking.firewall.allowedTCPPorts = [ 6600 ]; |
65e64925 | 25 | users.users.mpd.extraGroups = [ "wwwrun" "keys" ]; |
81b9ff89 | 26 | systemd.services.mpd.serviceConfig.RuntimeDirectory = "mpd"; |
17f6eae9 IB |
27 | services.filesWatcher.mpd = { |
28 | restart = true; | |
29 | paths = [ "/var/secrets/mpd-config" ]; | |
30 | }; | |
31 | ||
e229e6f2 IB |
32 | services.mpd = { |
33 | enable = true; | |
34 | network.listenAddress = "any"; | |
35 | musicDirectory = myconfig.env.mpd.folder; | |
36 | extraConfig = '' | |
742697c9 | 37 | include "/var/secrets/mpd-config" |
e229e6f2 IB |
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" | |
9df76627 | 47 | bind_to_address "/run/mpd/ogg.sock" |
e229e6f2 IB |
48 | quality "5.0" |
49 | format "44100:16:1" | |
50 | } | |
51 | audio_output { | |
52 | type "httpd" | |
53 | name "MP3" | |
54 | encoder "lame" | |
9df76627 | 55 | bind_to_address "/run/mpd/mp3.sock" |
e229e6f2 IB |
56 | quality "5.0" |
57 | format "44100:16:1" | |
58 | } | |
59 | ||
60 | ||
61 | ''; | |
62 | }; | |
63 | }; | |
64 | } | |
65 |