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