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