summaryrefslogtreecommitdiff
path: root/modules/nixosModules/server/navidrome.nix
blob: 903e574620d691d49694b3fde5d2882d3c06a6ea (plain)
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
{self, ...}: {
  flake.nixosModules.navidrome = {config, ...}: let
    cfg = config.hostOptions.server;
  in {
    imports = [
      self.nixosModules.hostOptions
      self.nixosModules.nginx
    ];

    services.navidrome = {
      enable = true;
      settings = {
        MusicFolder = "${cfg.mediaPath}/audio";
        DataFolder = "${cfg.dataPath}/navidrome";
        Address = "127.0.0.1";
        Port = 4533;
        EnableTranscoding = true;
        EnableMediaDeletion = true;
        Scanner.PurgeMissing = "always";
        EnableSharing = true;
        DefaultShareExpiration = "24h";
      };
    };

    services.nginx.virtualHosts."music.${cfg.domain}" = {
      enableACME = true;
      forceSSL = true;
      locations."/".proxyPass = "http://127.0.0.1:4553";
    };
  };
}