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