diff --git a/hosts/chunk/backup.nix b/hosts/chunk/backup.nix new file mode 100644 index 0000000..287a282 --- /dev/null +++ b/hosts/chunk/backup.nix @@ -0,0 +1,20 @@ +{ + config, + ... +}: +{ + my.backup = { + enable = true; + jobName = "crashRsync"; + paths = [ + "/vw-data" + ]; + exclude = [ + # podman stuff + "/var/lib/containers" + ]; + repo = "crash"; + passFile = config.sops.secrets."borg/rsyncnet".path; + sshKeyFile = config.sops.secrets."rsyncnet/id_ed25519".path; + }; +} diff --git a/hosts/chunk/borg.nix b/hosts/chunk/borg.nix deleted file mode 100644 index b3a76b5..0000000 --- a/hosts/chunk/borg.nix +++ /dev/null @@ -1,64 +0,0 @@ -{ - pkgs, - config, - ... -}: -{ - services.borgbackup.jobs.crashRsync = { - # systemd.timer(5) - persistentTimer = true; - paths = [ - "/root" - "/home" - "/var/backup" - "/var/lib" - "/opt" - "/etc" - "/vw-data" - ]; - exclude = [ - "**/.cache" - "**/node_modules" - "**/cache" - "**/Cache" - "/var/lib/docker" - "/var/lib/containers/cache" - "/var/lib/containers/overlay*" - "/var/lib/systemd" - "**/.rustup" - "**/.cargo" - "**/.docker" - ]; - repo = "de3911@de3911.rsync.net:borg/crash"; - encryption = { - mode = "repokey-blake2"; - passCommand = "cat ${config.sops.secrets."borg/rsyncnet".path}"; - }; - environment = { - BORG_RSH = ''ssh -i ${config.sops.secrets."rsyncnet/id_ed25519".path}''; - BORG_REMOTE_PATH = "borg1"; - BORG_EXIT_CODES = "modern"; - }; - compression = "auto,zstd,8"; - startAt = "hourly"; - extraCreateArgs = [ - "--stats" - "-x" - ]; - # warnings are often not that serious - failOnWarnings = false; - postHook = '' - ${pkgs.curl}/bin/curl -O /dev/null -u $(cat ${ - config.sops.secrets."services/ntfy".path - }) -d "chunk: backup completed with exit code: $exitStatus - $(journalctl --output-fields=MESSAGE -o cat -qu borgbackup-job-crashRsync.service |tail -n 10) - " https://ntfy.cything.io/ytnix - ''; - - prune.keep = { - within = "2d"; - daily = 365; - }; - extraPruneArgs = [ "--stats" ]; - }; -} diff --git a/hosts/chunk/default.nix b/hosts/chunk/default.nix index f1449c2..9d5597b 100644 --- a/hosts/chunk/default.nix +++ b/hosts/chunk/default.nix @@ -11,7 +11,7 @@ ../yt.nix ./hardware-configuration.nix ./gitlab.nix - ./borg.nix + ./backup.nix ./rclone.nix ./postgres.nix ./wireguard.nix