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