]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - nixops/modules/mpd/default.nix
Move diaspora to new secrets
[perso/Immae/Config/Nix.git] / nixops / modules / mpd / default.nix
CommitLineData
e229e6f2
IB
1{ lib, pkgs, config, myconfig, mylibs, ... }:
2{
3 config = {
65e64925
IB
4 nixpkgs.overlays = [ (self: super: rec {
5 mpd = (self.callPackage ./mpd.nix {}).mpd;
6 }) ];
914dd76c
IB
7 deployment.keys = {
8 mpd = {
9 permissions = "0400";
10 text = myconfig.env.mpd.password;
11 };
65e64925
IB
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 };
914dd76c 20 };
e229e6f2 21 networking.firewall.allowedTCPPorts = [ 6600 ];
65e64925 22 users.users.mpd.extraGroups = [ "wwwrun" "keys" ];
9df76627
IB
23 system.activationScripts.mpd = ''
24 install -d -m 0755 -o mpd -g mpd /run/mpd
25 '';
e229e6f2
IB
26 services.mpd = {
27 enable = true;
28 network.listenAddress = "any";
29 musicDirectory = myconfig.env.mpd.folder;
30 extraConfig = ''
65e64925 31 include "/run/keys/mpd-config"
e229e6f2
IB
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"
9df76627 41 bind_to_address "/run/mpd/ogg.sock"
e229e6f2
IB
42 quality "5.0"
43 format "44100:16:1"
44 }
45 audio_output {
46 type "httpd"
47 name "MP3"
48 encoder "lame"
9df76627 49 bind_to_address "/run/mpd/mp3.sock"
e229e6f2
IB
50 quality "5.0"
51 format "44100:16:1"
52 }
53
54
55 '';
56 };
57 };
58}
59