about summary refs log tree commit diff
path: root/profiles/music-server.nix
blob: 5757db5bf676cca4c484938741e897f249fb30f3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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 = [ config.systemd.services.navidrome.serviceConfig.WorkingDirectory ];
    exclude = [ "${config.systemd.services.navidrome.serviceConfig.WorkingDirectory}/cache/" ];
  };
}