]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - nixops/modules/mpd.nix
Move secrets module outside of nixops
[perso/Immae/Config/Nix.git] / nixops / modules / mpd.nix
CommitLineData
e229e6f2
IB
1{ lib, pkgs, config, myconfig, mylibs, ... }:
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" ];
9df76627
IB
22 system.activationScripts.mpd = ''
23 install -d -m 0755 -o mpd -g mpd /run/mpd
24 '';
e229e6f2
IB
25 services.mpd = {
26 enable = true;
27 network.listenAddress = "any";
28 musicDirectory = myconfig.env.mpd.folder;
29 extraConfig = ''
742697c9 30 include "/var/secrets/mpd-config"
e229e6f2
IB
31 audio_output {
32 type "null"
33 name "No Output"
34 mixer_type "none"
35 }
36 audio_output {
37 type "httpd"
38 name "OGG"
39 encoder "vorbis"
9df76627 40 bind_to_address "/run/mpd/ogg.sock"
e229e6f2
IB
41 quality "5.0"
42 format "44100:16:1"
43 }
44 audio_output {
45 type "httpd"
46 name "MP3"
47 encoder "lame"
9df76627 48 bind_to_address "/run/mpd/mp3.sock"
e229e6f2
IB
49 quality "5.0"
50 format "44100:16:1"
51 }
52
53
54 '';
55 };
56 };
57}
58