copy nb configuration and modules
This commit is contained in:
80
utils/modules/snapserver.nix
Normal file
80
utils/modules/snapserver.nix
Normal file
@@ -0,0 +1,80 @@
|
||||
{ pkgs, config, python3Packages, ... }:
|
||||
let
|
||||
shairport-sync = pkgs.shairport-sync.overrideAttrs (_: {
|
||||
configureFlags = [
|
||||
"--with-alsa" "--with-pipe" "--with-pa" "--with-stdout"
|
||||
"--with-avahi" "--with-ssl=openssl" "--with-soxr"
|
||||
"--without-configfiles"
|
||||
"--sysconfdir=/etc"
|
||||
"--with-metadata"
|
||||
];
|
||||
});
|
||||
in
|
||||
{
|
||||
services.snapserver = {
|
||||
enable = true;
|
||||
codec = "flac";
|
||||
http.docRoot = "${pkgs.snapcast}/share/snapserver/snapweb";
|
||||
streams.mopidy = {
|
||||
type = "pipe";
|
||||
location = "/run/snapserver/mopidy";
|
||||
};
|
||||
streams.airplay = {
|
||||
type = "airplay";
|
||||
location = "${shairport-sync}/bin/shairport-sync";
|
||||
query = {
|
||||
devicename = "Multi Room";
|
||||
port = "5000";
|
||||
params = "--mdns=avahi";
|
||||
};
|
||||
};
|
||||
streams.mixed = {
|
||||
type = "meta";
|
||||
location = "/airplay/mopidy";
|
||||
};
|
||||
};
|
||||
|
||||
services.avahi.enable = true;
|
||||
services.avahi.publish.enable = true;
|
||||
services.avahi.publish.userServices = true;
|
||||
|
||||
# services.shairport-sync = {
|
||||
# enable = true;
|
||||
# arguments = "-v -o=pipe -- pipe:name=/run/snapserver/airplay";
|
||||
# };
|
||||
|
||||
services.nginx.virtualHosts."snapcast.cloonar.com" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
acmeRoot = null;
|
||||
extraConfig = ''
|
||||
proxy_buffering off;
|
||||
'';
|
||||
locations."/".extraConfig = ''
|
||||
proxy_pass http://127.0.0.1:1780;
|
||||
proxy_set_header Host $host;
|
||||
proxy_redirect http:// https://;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
networking.firewall.allowedTCPPorts = [
|
||||
80 # http
|
||||
443 # https
|
||||
1704 # snapcast
|
||||
1705 # snapcast
|
||||
5000 # airplay
|
||||
5353 # airplay
|
||||
];
|
||||
networking.firewall.allowedUDPPorts = [
|
||||
5000 # airplay
|
||||
5353 # airplay
|
||||
];
|
||||
networking.firewall.allowedUDPPortRanges = [
|
||||
{ from = 6001; to = 6011; } # airplay
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user