diff --git a/hosts/nixos/hs/home.nix b/hosts/nixos/hs/home.nix index 364508e..06b673e 100644 --- a/hosts/nixos/hs/home.nix +++ b/hosts/nixos/hs/home.nix @@ -17,17 +17,6 @@ ]; }; - services.scheduled-commands.backup-to-thinkpad = { - enable = true; - description = "Backup files to thinkpad"; - interval = "*-*-* 00:00:00"; - commands = [ - "rsync-backup /mnt/storage/appbulk/immich/library/admin thinkpad:~/Backup/photo-library" - "rsync-backup /mnt/storage/Media/DCIM thinkpad:~/Backup/DCIM" - "rsync-backup /mnt/storage/Media/nsfw thinkpad:~/Backup/nsfw" - ]; - }; - home.packages = with pkgs; [ ]; diff --git a/hosts/nixos/hs/system.nix b/hosts/nixos/hs/system.nix index e1b4c58..a6cb7e3 100644 --- a/hosts/nixos/hs/system.nix +++ b/hosts/nixos/hs/system.nix @@ -214,7 +214,7 @@ showDiskUsage = true; diskUsagePaths = [ "/" "/home/" "/mnt/storage" "/mnt/parity" ]; showSnapraidStatus = true; - showBorgStatus = false; + showBorgStatus = true; }; services.tailscale-custom = { @@ -239,4 +239,30 @@ plex.enable = true; }; + # Borg backup configuration + services.borg-client-custom = { + enable = true; + repositoryUrl = "ssh://backup-box/./hs"; + backupPaths = [ + "/mnt/storage/appbulk/immich/library/" + "/mnt/storage/Media/DCIM" + "/mnt/storage/Media/nsfw" + ]; + backupFrequency = "*-*-* 00:00:00"; + retention = { + keepDaily = 7; + keepWeekly = 4; + keepMonthly = 6; + keepYearly = 2; + }; + passphraseFile = "/etc/borg-passphrase"; + + preHook = '' + echo "$(date): Starting Borg backup of ${config.networking.hostName}" + ''; + postHook = '' + echo "$(date): Borg backup of ${config.networking.hostName} completed successfully" + ''; + }; + } diff --git a/modules/ssh.nix b/modules/ssh.nix index a6efdab..bc0c94e 100644 --- a/modules/ssh.nix +++ b/modules/ssh.nix @@ -54,6 +54,13 @@ identityFile = "~/Credentials/ssh_keys/hetzner"; }; + "backup-box" = { + hostname = "u515619.your-storagebox.de"; + user = "u515619"; + identityFile = "~/Credentials/ssh_keys/hetzner"; + port = 23; + }; + }; }; }