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