X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=nixops%2Fmodules%2Fmpd.nix;fp=nixops%2Fmodules%2Fmpd.nix;h=7c896ca92ed2eacfcb6160e33cd87617aa06b978;hb=79d2de8b83d765721b2cb720b2bc59673df54a4a;hp=0000000000000000000000000000000000000000;hpb=86663f1789aecdb62e44a4be46e0ed111b795a09;p=perso%2FImmae%2FConfig%2FNix.git diff --git a/nixops/modules/mpd.nix b/nixops/modules/mpd.nix new file mode 100644 index 0000000..7c896ca --- /dev/null +++ b/nixops/modules/mpd.nix @@ -0,0 +1,58 @@ +{ lib, pkgs, config, myconfig, mylibs, ... }: +{ + config = { + mySecrets.keys = [ + { + dest = "mpd"; + permissions = "0400"; + text = myconfig.env.mpd.password; + } + { + dest = "mpd-config"; + permissions = "0400"; + user = "mpd"; + group = "mpd"; + text = '' + password "${myconfig.env.mpd.password}@read,add,control,admin" + ''; + } + ]; + networking.firewall.allowedTCPPorts = [ 6600 ]; + users.users.mpd.extraGroups = [ "wwwrun" "keys" ]; + system.activationScripts.mpd = '' + install -d -m 0755 -o mpd -g mpd /run/mpd + ''; + services.mpd = { + enable = true; + network.listenAddress = "any"; + musicDirectory = myconfig.env.mpd.folder; + extraConfig = '' + include "/var/secrets/mpd-config" + audio_output { + type "null" + name "No Output" + mixer_type "none" + } + audio_output { + type "httpd" + name "OGG" + encoder "vorbis" + bind_to_address "/run/mpd/ogg.sock" + quality "5.0" + format "44100:16:1" + } + audio_output { + type "httpd" + name "MP3" + encoder "lame" + bind_to_address "/run/mpd/mp3.sock" + quality "5.0" + format "44100:16:1" + } + + + ''; + }; + }; +} +