diff options
Diffstat (limited to 'nixops/modules/mpd.nix')
-rw-r--r-- | nixops/modules/mpd.nix | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/nixops/modules/mpd.nix b/nixops/modules/mpd.nix new file mode 100644 index 0000000..7c896ca --- /dev/null +++ b/nixops/modules/mpd.nix | |||
@@ -0,0 +1,58 @@ | |||
1 | { lib, pkgs, config, myconfig, mylibs, ... }: | ||
2 | { | ||
3 | config = { | ||
4 | mySecrets.keys = [ | ||
5 | { | ||
6 | dest = "mpd"; | ||
7 | permissions = "0400"; | ||
8 | text = myconfig.env.mpd.password; | ||
9 | } | ||
10 | { | ||
11 | dest = "mpd-config"; | ||
12 | permissions = "0400"; | ||
13 | user = "mpd"; | ||
14 | group = "mpd"; | ||
15 | text = '' | ||
16 | password "${myconfig.env.mpd.password}@read,add,control,admin" | ||
17 | ''; | ||
18 | } | ||
19 | ]; | ||
20 | networking.firewall.allowedTCPPorts = [ 6600 ]; | ||
21 | users.users.mpd.extraGroups = [ "wwwrun" "keys" ]; | ||
22 | system.activationScripts.mpd = '' | ||
23 | install -d -m 0755 -o mpd -g mpd /run/mpd | ||
24 | ''; | ||
25 | services.mpd = { | ||
26 | enable = true; | ||
27 | network.listenAddress = "any"; | ||
28 | musicDirectory = myconfig.env.mpd.folder; | ||
29 | extraConfig = '' | ||
30 | include "/var/secrets/mpd-config" | ||
31 | audio_output { | ||
32 | type "null" | ||
33 | name "No Output" | ||
34 | mixer_type "none" | ||
35 | } | ||
36 | audio_output { | ||
37 | type "httpd" | ||
38 | name "OGG" | ||
39 | encoder "vorbis" | ||
40 | bind_to_address "/run/mpd/ogg.sock" | ||
41 | quality "5.0" | ||
42 | format "44100:16:1" | ||
43 | } | ||
44 | audio_output { | ||
45 | type "httpd" | ||
46 | name "MP3" | ||
47 | encoder "lame" | ||
48 | bind_to_address "/run/mpd/mp3.sock" | ||
49 | quality "5.0" | ||
50 | format "44100:16:1" | ||
51 | } | ||
52 | |||
53 | |||
54 | ''; | ||
55 | }; | ||
56 | }; | ||
57 | } | ||
58 | |||