services: navidrome: setup restic backups

This commit is contained in:
Antoine Martin 2021-08-22 17:48:45 +02:00
parent 8157595747
commit c94356e24f
2 changed files with 13 additions and 5 deletions

View file

@ -114,7 +114,7 @@ in
navidrome = { navidrome = {
enable = true; enable = true;
musicFolder = "${config.services.nextcloud.home}/data/alarsyo/files/Musique/Songs"; musicFolder.path = "${config.services.nextcloud.home}/data/alarsyo/files/Musique/Songs";
}; };
nextcloud = { nextcloud = {

View file

@ -8,10 +8,13 @@ let
in { in {
options.my.services.navidrome = { options.my.services.navidrome = {
enable = mkEnableOption "Navidrome"; enable = mkEnableOption "Navidrome";
musicFolder = mkOption { musicFolder = {
path = mkOption {
type = types.str; type = types.str;
default = "./music"; default = "./music";
}; };
backup = mkEnableOption "backup the music folder";
};
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
@ -21,10 +24,15 @@ in {
Address = "127.0.0.1"; Address = "127.0.0.1";
Port = 4533; Port = 4533;
LastFM.Enabled = false; LastFM.Enabled = false;
MusicFolder = cfg.musicFolder; MusicFolder = cfg.musicFolder.path;
}; };
}; };
my.services.restic-backup = {
paths = [ "/var/lib/navidrome" ] ++ optional cfg.musicFolder.backup cfg.musicFolder.path;
exclude = [ "/var/lib/navidrome/cache" ];
};
services.nginx.virtualHosts."music.${domain}" = { services.nginx.virtualHosts."music.${domain}" = {
forceSSL = true; forceSSL = true;
useACMEHost = domain; useACMEHost = domain;