all repos — nixfiles @ ad16f1d5c06ed15908218a2e567c7960fcf221d5

System and user configuration, managed by nix and home-manager

add music library roles

Alin
commit

ad16f1d5c06ed15908218a2e567c7960fcf221d5

parent

4f52e77deb0a970e98d8c75701b64dd9fa49b0de

1 file changed, 69 insertions(+), 0 deletions(-)

changed files
A system/roles/music-library/streaming-server.nix
@@ -0,0 +1,69 @@
+{ + config, + lib, + pkgs, + ... +}: +let + inherit (config.networking) domain fqdn; + inherit (import ../../../data) homenet tailnet; + navidromeUpstream = + let + navidrome = config.services.navidrome.settings; + in + '' + reverse_proxy ${navidrome.Address}:${toString navidrome.Port} + ''; +in +{ + services.navidrome = { + enable = true; + plugins = with pkgs.navidromePlugins; [ + apple-music + ]; + settings = { + MusicFolder = "/srv/music/library"; + + Agents = "listenbrainz,deezer"; + + AutoTranscodeDownload = true; + DefaultTheme = "Auto"; + EnableMediaFileCoverArt = false; + PreferSortTags = true; + TranscodingCacheSize = "1GiB"; + + Subsonic.AppendAlbumVersion = false; + Scanner = { + ScanOnStartup = false; + }; + }; + }; + + services.caddy.virtualHosts = { + "music.${domain}" = { + extraConfig = '' + ${lib.optionalString (domain == homenet) '' + tls { + issuer internal { + ca home + } + } + ''} + ${navidromeUpstream} + ''; + }; + "music.${tailnet}" = { + extraConfig = '' + bind tailscale/music + tls { + get_certificate tailscale + } + ${navidromeUpstream} + ''; + }; + }; + + services.dnsmasq.settings.cname = [ + "music.${domain},${fqdn}" + ]; +}