From 7ce48f71641dc093536f229d972d3f660af2ac44 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Sun, 22 Aug 2021 16:40:57 +0200 Subject: [PATCH] services: add navidrome --- services/default.nix | 1 + services/navidrome.nix | 47 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 services/navidrome.nix diff --git a/services/default.nix b/services/default.nix index 5f894c4..9412e57 100644 --- a/services/default.nix +++ b/services/default.nix @@ -13,6 +13,7 @@ ./media.nix ./miniflux.nix ./monitoring.nix + ./navidrome.nix ./nextcloud.nix ./nginx.nix ./nuage.nix diff --git a/services/navidrome.nix b/services/navidrome.nix new file mode 100644 index 0000000..33372f6 --- /dev/null +++ b/services/navidrome.nix @@ -0,0 +1,47 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.my.services.navidrome; + domain = config.networking.domain; +in { + options.my.services.navidrome = { + enable = mkEnableOption "Navidrome"; + }; + + config = lib.mkIf cfg.enable { + services.navidrome = { + enable = true; + settings = { + Address = "127.0.0.1"; + Port = 4533; + LastFM.Enabled = false; + }; + }; + + services.nginx.virtualHosts."music.${domain}" = { + forceSSL = true; + useACMEHost = domain; + + listen = [ + # FIXME: hardcoded tailscale IP + { + addr = "100.80.61.67"; + port = 443; + ssl = true; + } + { + addr = "100.80.61.67"; + port = 80; + ssl = false; + } + ]; + + locations."/" = { + proxyPass = "http://127.0.0.1:${toString config.services.navidrome.settings.Port}/"; + proxyWebsockets = true; + }; + }; + }; +}