]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - nixops/modules/mpd/default.nix
Use sockets instead of ports in mpd
[perso/Immae/Config/Nix.git] / nixops / modules / mpd / default.nix
1 { lib, pkgs, config, myconfig, mylibs, ... }:
2 {
3 config = {
4 nixpkgs.overlays = [ (self: super: rec {
5 mpd = (self.callPackage ./mpd.nix {}).mpd;
6 }) ];
7 deployment.keys = {
8 mpd = {
9 permissions = "0400";
10 text = myconfig.env.mpd.password;
11 };
12 mpd-config = {
13 permissions = "0400";
14 user = "mpd";
15 group = "mpd";
16 text = ''
17 password "${myconfig.env.mpd.password}@read,add,control,admin"
18 '';
19 };
20 };
21 networking.firewall.allowedTCPPorts = [ 6600 ];
22 users.users.mpd.extraGroups = [ "wwwrun" "keys" ];
23 system.activationScripts.mpd = ''
24 install -d -m 0755 -o mpd -g mpd /run/mpd
25 '';
26 services.mpd = {
27 enable = true;
28 network.listenAddress = "any";
29 musicDirectory = myconfig.env.mpd.folder;
30 extraConfig = ''
31 include "/run/keys/mpd-config"
32 audio_output {
33 type "null"
34 name "No Output"
35 mixer_type "none"
36 }
37 audio_output {
38 type "httpd"
39 name "OGG"
40 encoder "vorbis"
41 bind_to_address "/run/mpd/ogg.sock"
42 quality "5.0"
43 format "44100:16:1"
44 }
45 audio_output {
46 type "httpd"
47 name "MP3"
48 encoder "lame"
49 bind_to_address "/run/mpd/mp3.sock"
50 quality "5.0"
51 format "44100:16:1"
52 }
53
54
55 '';
56 };
57 };
58 }
59