This commit is contained in:
Lukas Wurzinger 2025-01-05 01:06:14 +01:00
parent c99999ce28
commit 1d41e38765
No known key found for this signature in database
2 changed files with 6 additions and 4 deletions

View file

@ -20,9 +20,9 @@ in {
description = "Local rsync Backup ${backupName}"; description = "Local rsync Backup ${backupName}";
wantedBy = ["timers.target"]; wantedBy = ["timers.target"];
timerConfig = { timerConfig = {
OnCalendar = "*-*-* 03:00:00"; OnCalendar = "*-*-* 03:00:00"; # TODO
Persistent = true; Persistent = true;
Unit = "${systemdName}.service"; Unit = "${systemdName}.service"; # TODO
}; };
}; };
@ -33,6 +33,7 @@ in {
User = "root"; User = "root";
Group = "root"; Group = "root";
}; };
# TODO
script = '' script = ''
${lib.getExe pkgs.rsync} --verbose --verbose --archive --update --delete --mkpath -- ${backups.${backupName}}/ /srv/backup/${backupName}/ ${lib.getExe pkgs.rsync} --verbose --verbose --archive --update --delete --mkpath -- ${backups.${backupName}}/ /srv/backup/${backupName}/
''; '';
@ -52,7 +53,7 @@ in {
passwordFile = config.age.secrets."restic-${attrName}".path; passwordFile = config.age.secrets."restic-${attrName}".path;
pruneOpts = ["--keep-daily 7" "--keep-weekly 5" "--keep-monthly 12"]; pruneOpts = ["--keep-daily 7" "--keep-weekly 5" "--keep-monthly 12"];
timerConfig = { timerConfig = {
OnCalendar = "*-*-* 03:00:00"; OnCalendar = "*-*-* 03:00:00"; # TODO
Persistent = true; Persistent = true;
}; };
extraOptions = ["sftp.args='-i /etc/ssh/ssh_host_ed25519_key -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'"]; extraOptions = ["sftp.args='-i /etc/ssh/ssh_host_ed25519_key -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'"];

View file

@ -15,6 +15,7 @@
post = let post = let
remoteDir = self.nixosConfigurations.abacus.config.services.navidrome.settings.MusicFolder; remoteDir = self.nixosConfigurations.abacus.config.services.navidrome.settings.MusicFolder;
rsyncExe = lib.getExe pkgs.rsync; rsyncExe = lib.getExe pkgs.rsync;
rsh = "${lib.getExe pkgs.openssh} -i /etc/ssh/ssh_host_ed25519_key -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null";
in '' in ''
${rsyncExe} \ ${rsyncExe} \
--archive \ --archive \
@ -24,7 +25,7 @@
--mkpath \ --mkpath \
--verbose --verbose \ --verbose --verbose \
--exclude lost+found \ --exclude lost+found \
--rsh 'ssh -i /etc/ssh/ssh_host_ed25519_key -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' \ --rsh ${lib.escapeShellArg rsh} \
/srv/compmusic/ root@wrz.one:${remoteDir} /srv/compmusic/ root@wrz.one:${remoteDir}
''; '';
}; };