54 lines
1.2 KiB
Nix
54 lines
1.2 KiB
Nix
{
|
|
lib,
|
|
pkgs,
|
|
config,
|
|
...
|
|
}:
|
|
with lib;
|
|
{
|
|
options = {
|
|
mpd = {
|
|
enable = mkEnableOption "enables MPD";
|
|
port = lib.mkOption {
|
|
type = lib.types.int;
|
|
default = 6600;
|
|
description = "The port that MPD is served on.";
|
|
};
|
|
httpPort = lib.mkOption {
|
|
type = lib.types.int;
|
|
default = 8006;
|
|
description = "The port that MPD is served on.";
|
|
};
|
|
musicDir = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "/home/fw/Music";
|
|
description = "the path to the Music";
|
|
};
|
|
};
|
|
};
|
|
config = mkMerge [
|
|
(mkIf config.mpd.enable {
|
|
services.mpd = {
|
|
enable = true;
|
|
user = "fw";
|
|
group = "users";
|
|
network = {
|
|
port = config.mpd.port;
|
|
listenAddress = "any";
|
|
};
|
|
musicDirectory = config.mpd.musicDir;
|
|
extraConfig = ''
|
|
audio_output {
|
|
type "httpd"
|
|
name "My HTTP Stream"
|
|
encoder "vorbis" # or "mp3" if you have lame installed
|
|
port "${toString config.mpd.httpPort}" # default HTTP port
|
|
bind_to_address "0.0.0.0" # listen on all network interfaces
|
|
quality "5.0" # Ogg Vorbis quality
|
|
}
|
|
'';
|
|
};
|
|
})
|
|
];
|
|
|
|
}
|