about summary refs log tree commit diff
path: root/modules/services/navidrome/default.nix
blob: 1c3725b036fb12deeab15a07f2768d3409ab6d73 (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
{ config, pkgs, lib, ... }:
let cfg = config.my.services.navidrome;
in {
  options.my.services.navidrome = with lib; {
    enable = mkEnableOption "Navidrome Music Server";
    musicFolder = mkOption {
      type = types.str;
      example = "/data/fast/music";
      description = "Music folder";
    };
  };

  config = lib.mkIf cfg.enable {
    services.navidrome = {
      enable = true;
      settings = {
        MusicFolder = cfg.musicFolder;
        Address = "0.0.0.0";
        httpPort = "4533";
      };
    };

    services.restic.backups = {
      navidrome = {
        paths = [ "/var/lib/navidrome/" ];
        repository = "/data/slow/backups/systems";
        passwordFile = config.age.secrets.restic-repo-systems.path;
        timerConfig = { OnCalendar = "00:35"; };
        initialize = true;
        extraBackupArgs = [ "--tag navidrome" ];
        pruneOpts = [ "--keep-daily 7" "--keep-weekly 4" ];
      };
    };

    networking.firewall.allowedTCPPorts = [ 4533 ];
  };
}