diff --git a/hosts/nullbox/backup.nix b/hosts/nullbox/backup.nix new file mode 100644 index 0000000..28993b7 --- /dev/null +++ b/hosts/nullbox/backup.nix @@ -0,0 +1,30 @@ +{ config, lib, pkgs, ... }: +let + secret = name: config.age.secrets."${name}".path; +in +{ + config = { + age.secrets.restic-rclone.file = ../../secrets/restic-rclone.age; + age.secrets.restic-password.file = ../../secrets/restic-password.age; + services.restic.backups.system = { + rcloneConfigFile = secret "restic-rclone"; + passwordFile = secret "restic-password"; + repository = "rclone:restic:"; + exclude = [ + ".snapshots" + ]; + paths = [ + "/srv/mcserver" + ]; + dynamicFilesFrom = '' + echo + ''; + + extraBackupArgs = [ + "--tag=auto" + "--group-by=host,tag" + ]; + + }; + }; +} diff --git a/hosts/nullbox/configuration.nix b/hosts/nullbox/configuration.nix index 46d8d3b..066a0b8 100644 --- a/hosts/nullbox/configuration.nix +++ b/hosts/nullbox/configuration.nix @@ -15,6 +15,8 @@ ./mcserver.nix ./impermanence.nix + + ./backup.nix ]; config = {