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