diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-12-13 21:25:24 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-05-24 01:40:13 +0200 |
commit | 252dd7d899b7a0deea1537cc5d2d48b825afffb0 (patch) | |
tree | f51c3c9cd7429b0b9553a840f26bee489be045bc /modules/private/mpd.nix | |
download | NUR-nur_root.tar.gz NUR-nur_root.tar.zst NUR-nur_root.zip |
Initial commit published for NURnur_root
Diffstat (limited to 'modules/private/mpd.nix')
-rw-r--r-- | modules/private/mpd.nix | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/modules/private/mpd.nix b/modules/private/mpd.nix new file mode 100644 index 00000000..9903bdf0 --- /dev/null +++ b/modules/private/mpd.nix | |||
@@ -0,0 +1,56 @@ | |||
1 | { lib, pkgs, config, myconfig, ... }: | ||
2 | { | ||
3 | config = { | ||
4 | secrets.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 | systemd.services.mpd.serviceConfig.RuntimeDirectory = "mpd"; | ||
23 | services.mpd = { | ||
24 | enable = true; | ||
25 | network.listenAddress = "any"; | ||
26 | musicDirectory = myconfig.env.mpd.folder; | ||
27 | extraConfig = '' | ||
28 | include "/var/secrets/mpd-config" | ||
29 | audio_output { | ||
30 | type "null" | ||
31 | name "No Output" | ||
32 | mixer_type "none" | ||
33 | } | ||
34 | audio_output { | ||
35 | type "httpd" | ||
36 | name "OGG" | ||
37 | encoder "vorbis" | ||
38 | bind_to_address "/run/mpd/ogg.sock" | ||
39 | quality "5.0" | ||
40 | format "44100:16:1" | ||
41 | } | ||
42 | audio_output { | ||
43 | type "httpd" | ||
44 | name "MP3" | ||
45 | encoder "lame" | ||
46 | bind_to_address "/run/mpd/mp3.sock" | ||
47 | quality "5.0" | ||
48 | format "44100:16:1" | ||
49 | } | ||
50 | |||
51 | |||
52 | ''; | ||
53 | }; | ||
54 | }; | ||
55 | } | ||
56 | |||