feat(navidrome): add backup
This commit is contained in:
parent
84ee10e688
commit
fd7487015f
2 changed files with 61 additions and 27 deletions
|
|
@ -1,8 +1,4 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}: {
|
||||
{pkgs, ...}: {
|
||||
imports = [
|
||||
../../modules/zfs_unencrypted.nix
|
||||
../../modules/shared.nix
|
||||
|
|
@ -21,28 +17,6 @@
|
|||
clan.core.networking.targetHost = "root@moritz-server";
|
||||
nix.package = pkgs.lixPackageSets.latest.lix;
|
||||
|
||||
services.navidrome = {
|
||||
enable = true;
|
||||
settings = {
|
||||
MusicFolder = "/mnt/music/tagged";
|
||||
};
|
||||
};
|
||||
|
||||
services.nginx = {
|
||||
virtualHosts = {
|
||||
"music.moritz.place" = {
|
||||
forceSSL = true;
|
||||
useACMEHost = "any.moritz.place";
|
||||
locations."/" = {
|
||||
proxyPass = "http://${config.services.navidrome.settings.Address}:${builtins.toString config.services.navidrome.settings.Port}";
|
||||
# extraConfig = ''
|
||||
# proxy_redirect off
|
||||
# '';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
networking = {
|
||||
interfaces.enp2s0 = {
|
||||
ipv4.addresses = [
|
||||
|
|
|
|||
60
machines/moritz-server/navidrome.nix
Normal file
60
machines/moritz-server/navidrome.nix
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
services.navidrome = {
|
||||
enable = true;
|
||||
settings = {
|
||||
MusicFolder = "/mnt/music/tagged";
|
||||
};
|
||||
};
|
||||
|
||||
services.nginx = {
|
||||
virtualHosts = {
|
||||
"music.moritz.place" = {
|
||||
forceSSL = true;
|
||||
useACMEHost = "any.moritz.place";
|
||||
locations."/" = {
|
||||
proxyPass = "http://${config.services.navidrome.settings.Address}:${builtins.toString config.services.navidrome.settings.Port}";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.borgbackup.jobs = {
|
||||
mailDirectory = {
|
||||
paths = config.services.navidrome.settings.MusicFolder;
|
||||
repo = "u461386-sub1@u461386.your-storagebox.de:musicFolder";
|
||||
doInit = true;
|
||||
encryption = {
|
||||
mode = "repokey";
|
||||
passCommand = "cat ${config.clan.core.vars.generators.borg-navidrome.files.password.path}";
|
||||
};
|
||||
environment = {BORG_RSH = "ssh -i ${config.clan.core.vars.generators.borg-navidrome.files."ssh.id_ed25519".path} -p 23";};
|
||||
compression = "auto,zstd";
|
||||
startAt = "hourly";
|
||||
persistentTimer = true;
|
||||
prune.keep = {
|
||||
within = "1d"; # Keep all archives from the last day
|
||||
daily = 7;
|
||||
weekly = 3;
|
||||
monthly = 3;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
clan.core.vars.generators.borg-navidrome = {
|
||||
prompts.password.persist = true;
|
||||
|
||||
files."ssh.id_ed25519" = {};
|
||||
files."ssh.id_ed25519.pub".secret = false;
|
||||
runtimeInputs = [
|
||||
pkgs.coreutils
|
||||
pkgs.openssh
|
||||
];
|
||||
script = ''
|
||||
ssh-keygen -t ed25519 -N "" -f "$out"/ssh.id_ed25519
|
||||
'';
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue