]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - nixops/modules/mpd.nix
Move secrets module outside of nixops
[perso/Immae/Config/Nix.git] / nixops / modules / mpd.nix
1 { lib, pkgs, config, myconfig, mylibs, ... }:
2 {
3 config = {
4 secrets.keys = [
5 {
6 dest = "mpd";
7 permissions = "0400";
8 text = myconfig.env.mpd.password;
9 }
10 {
11 dest = "mpd-config";
12 permissions = "0400";
13 user = "mpd";
14 group = "mpd";
15 text = ''
16 password "${myconfig.env.mpd.password}@read,add,control,admin"
17 '';
18 }
19 ];
20 networking.firewall.allowedTCPPorts = [ 6600 ];
21 users.users.mpd.extraGroups = [ "wwwrun" "keys" ];
22 system.activationScripts.mpd = ''
23 install -d -m 0755 -o mpd -g mpd /run/mpd
24 '';
25 services.mpd = {
26 enable = true;
27 network.listenAddress = "any";
28 musicDirectory = myconfig.env.mpd.folder;
29 extraConfig = ''
30 include "/var/secrets/mpd-config"
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"
40 bind_to_address "/run/mpd/ogg.sock"
41 quality "5.0"
42 format "44100:16:1"
43 }
44 audio_output {
45 type "httpd"
46 name "MP3"
47 encoder "lame"
48 bind_to_address "/run/mpd/mp3.sock"
49 quality "5.0"
50 format "44100:16:1"
51 }
52
53
54 '';
55 };
56 };
57 }
58