about summary refs log tree commit diff
path: root/profiles
diff options
context:
space:
mode:
Diffstat (limited to 'profiles')
-rw-r--r--profiles/music-server.nix40
1 files changed, 40 insertions, 0 deletions
diff --git a/profiles/music-server.nix b/profiles/music-server.nix
new file mode 100644
index 0000000..9ed665b
--- /dev/null
+++ b/profiles/music-server.nix
@@ -0,0 +1,40 @@
+{ config, pkgs, lib, ... }:
+let
+  musicFolder = "/data/fast/music";
+  vhostName = "music.${config.homelab.domain}";
+in
+{
+  # https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/audio/navidrome.nix
+  services.navidrome = {
+    enable = true;
+    settings = {
+      MusicFolder = musicFolder;
+    };
+  };
+
+  services.nginx.virtualHosts."${vhostName}" = {
+    forceSSL = true;
+    useACMEHost = config.homelab.domain;
+    listen = [
+      {
+        addr = "192.168.6.40";
+        port = 443;
+        ssl = true;
+      }
+      {
+        addr = "192.168.6.40";
+        port = 80;
+        ssl = false;
+      }
+    ];
+    locations."/" = {
+      proxyPass = "http://127.0.0.1:4533";
+      proxyWebsockets = true;
+    };
+  };
+
+  my.services.backup = {
+    paths = [ systemd.services.navidrome.WorkingDirectory ];
+    exclude = [ "${systemd.services.navidrome.WorkingDirectory}/cache/" ];
+  };
+}