about summary refs log tree commit diff
path: root/modules/services/navidrome
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-04-13 14:17:00 -0700
committerFranck Cuny <franck@fcuny.net>2022-04-13 14:17:00 -0700
commit9c467c91b7596d28bd7007017f9c1364dfb27278 (patch)
tree5049cfa4a13f3f54a038ecb371adef601d4cec52 /modules/services/navidrome
parentgrafana: correct domain name ... (diff)
downloadworld-9c467c91b7596d28bd7007017f9c1364dfb27278.tar.gz
modules: make the vhost be configurable
Diffstat (limited to 'modules/services/navidrome')
-rw-r--r--modules/services/navidrome/default.nix18
1 files changed, 9 insertions, 9 deletions
diff --git a/modules/services/navidrome/default.nix b/modules/services/navidrome/default.nix
index 6ea0038..87f7422 100644
--- a/modules/services/navidrome/default.nix
+++ b/modules/services/navidrome/default.nix
@@ -5,6 +5,11 @@ let
 in {
   options.my.services.navidrome = with lib; {
     enable = mkEnableOption "Navidrome Music Server";
+    vhostName = mkOption {
+      type = types.str;
+      example = "music.fcuny.net";
+      description = "Name for the virtual host";
+    };
     musicFolder = mkOption {
       type = types.str;
       example = "/data/fast/music";
@@ -15,28 +20,23 @@ in {
   config = lib.mkIf cfg.enable {
     services.navidrome = {
       enable = true;
-      settings = {
-        MusicFolder = cfg.musicFolder;
-        Address = "0.0.0.0";
-        httpPort = "4533";
-      };
+      settings = { MusicFolder = cfg.musicFolder; };
     };
 
-    services.nginx.virtualHosts."music.fcuny.xyz" = {
+    services.nginx.virtualHosts."${cfg.vhostName}" = {
       forceSSL = true;
-      useACMEHost = "music.fcuny.xyz";
+      useACMEHost = cfg.vhostName;
       locations."/" = {
         proxyPass = "http://127.0.0.1:4533";
         proxyWebsockets = true;
       };
     };
 
-    security.acme.certs."music.fcuny.xyz" = {
+    security.acme.certs."${cfg.vhostName}" = {
       dnsProvider = "gcloud";
       credentialsFile = secrets."acme/credentials".path;
     };
 
     my.services.backup = { paths = [ "/var/lib/navidrome" ]; };
-    networking.firewall.allowedTCPPorts = [ 4533 ];
   };
 }