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