mpd: server stream + remote clients over tunnel
This commit is contained in:
1 parent
73a0527a33
commit
0ff70fc78c
3 files changed
+93
-35
No files matched your search
@@ -1,5 +1,5 @@
|
||||
{
|
||||
den.quirks.tunnel.description = "cloudflared ingress: { subdomain, port }";
|
||||
den.quirks.tunnel.description = "cloudflared ingress: { subdomain, port, scheme ? \"http\" }";
|
||||
|
||||
# per host: den.hosts.<sys>.<host>.cloudflared = { uuid = "..."; protocol = "http2"; # optional };
|
||||
den.aspects.services.cloudflared = {
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
ingress = lib.listToAttrs (map (t: {
|
||||
name = "${t.subdomain}.${domain}";
|
||||
value = "http://127.0.0.1:${toString t.port}";
|
||||
value = "${t.scheme or "http"}://127.0.0.1:${toString t.port}";
|
||||
}) tunnel);
|
||||
};
|
||||
};
|
||||
|
||||
+32
-30
@@ -1,41 +1,43 @@
|
||||
{
|
||||
# MPD on the server: plays ~/Music into an Opus HTTP stream, no local speakers.
|
||||
# music.<domain> = audio stream, mpd.<domain> = MPD protocol (via `cloudflared access tcp` on clients).
|
||||
# Password: ~/.config/mpd/password (same file on every device, chmod 600).
|
||||
den.aspects.services.mpd = {
|
||||
homeManager = {
|
||||
services.mpd-mpris.enable = true;
|
||||
};
|
||||
tunnel = [
|
||||
{ subdomain = "music"; port = 8000; }
|
||||
{ subdomain = "mpd"; port = 6600; scheme = "tcp"; }
|
||||
];
|
||||
|
||||
nixos = { host, config, ... }: let user = host.owner; home = config.users.users.${user}.home; in {
|
||||
services = {
|
||||
mpd = {
|
||||
enable = true;
|
||||
services.mpd = {
|
||||
enable = true;
|
||||
inherit user;
|
||||
|
||||
settings = {
|
||||
music_directory = "${home}/Music";
|
||||
credentials = [{
|
||||
passwordFile = "${home}/.config/mpd/password";
|
||||
permissions = [ "read" "add" "control" "admin" ];
|
||||
}];
|
||||
|
||||
decoder = [
|
||||
{
|
||||
plugin = "ffmpeg";
|
||||
enabled = "yes";
|
||||
}
|
||||
{
|
||||
plugin = "opus";
|
||||
enabled = "no";
|
||||
}
|
||||
];
|
||||
settings = {
|
||||
music_directory = "${home}/Music";
|
||||
|
||||
audio_output = [{
|
||||
type = "pipewire";
|
||||
name = "PipeWire Sound Server";
|
||||
}];
|
||||
};
|
||||
decoder = [
|
||||
{ plugin = "ffmpeg"; enabled = "yes"; }
|
||||
{ plugin = "opus"; enabled = "no"; }
|
||||
];
|
||||
|
||||
inherit user;
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services = {
|
||||
mpd.environment = {
|
||||
XDG_RUNTIME_DIR = "/run/user/1000";
|
||||
audio_output = [{
|
||||
type = "httpd";
|
||||
name = "stream";
|
||||
encoder = "opus";
|
||||
bitrate = "128000";
|
||||
format = "48000:16:2";
|
||||
bind_to_address = "127.0.0.1";
|
||||
port = "8000";
|
||||
always_on = "yes";
|
||||
tags = "yes";
|
||||
max_clients = "0";
|
||||
}];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user