mirror of
https://github.com/RGBCube/ncc
synced 2025-07-30 11:37:44 +00:00
Use a single Restic repository for a whole host
This commit is contained in:
parent
b3a23637f9
commit
1eb906e040
1 changed files with 34 additions and 40 deletions
|
@ -3,51 +3,45 @@
|
|||
systemConfiguration {
|
||||
secrets.resticPassword.file = ./password.age;
|
||||
|
||||
services.restic.backups = let
|
||||
defaultConfig = name: {
|
||||
repository = "sftp:backup@disk:${config.networking.hostName}-${name}";
|
||||
passwordFile = config.secrets.resticPassword.path;
|
||||
initialize = true;
|
||||
services.restic.backups.disk = {
|
||||
repository = "sftp:backup@disk:${config.networking.hostName}-backup";
|
||||
passwordFile = config.secrets.resticPassword.path;
|
||||
initialize = true;
|
||||
|
||||
pruneOpts = [
|
||||
"--keep-daily unlimited"
|
||||
"--keep-weekly unlimited"
|
||||
"--keep-monthly 6"
|
||||
"--keep-yearly 12"
|
||||
];
|
||||
pruneOpts = [
|
||||
"--keep-daily unlimited"
|
||||
"--keep-weekly unlimited"
|
||||
"--keep-monthly 6"
|
||||
"--keep-yearly 12"
|
||||
];
|
||||
|
||||
timerConfig = {
|
||||
OnCalendar = "daily";
|
||||
Persistent = true;
|
||||
};
|
||||
};
|
||||
in {
|
||||
general = (defaultConfig "general") // {
|
||||
paths = map (dir: "/var/lib/${dir}") [
|
||||
"dkim"
|
||||
"forgejo"
|
||||
"gitea-runner"
|
||||
"grafana"
|
||||
"mail"
|
||||
"matrix-sliding-sync"
|
||||
"matrix-synapse"
|
||||
"nextcloud"
|
||||
"postfix"
|
||||
];
|
||||
timerConfig = {
|
||||
OnCalendar = "daily";
|
||||
Persistent = true;
|
||||
};
|
||||
|
||||
postgresql = (defaultConfig "postgresql") // {
|
||||
paths = [ "/tmp/postgresql-dump.sql.gz" ];
|
||||
paths = [
|
||||
"/tmp/postgresql-dump.sql.gz"
|
||||
] ++ map (dir: "/var/lib/${dir}") [
|
||||
"dkim"
|
||||
"forgejo"
|
||||
"gitea-runner"
|
||||
"grafana"
|
||||
"mail"
|
||||
"matrix-sliding-sync"
|
||||
"matrix-synapse"
|
||||
"nextcloud"
|
||||
"postfix"
|
||||
];
|
||||
|
||||
backupPrepareCommand = ''
|
||||
${config.services.postgresql.package}/bin/pg_dumpall --clean \
|
||||
| ${lib.getExe pkgs.gzip} --rsyncable \
|
||||
> /tmp/postgresql-dump.sql.gz
|
||||
'';
|
||||
backupPrepareCommand = ''
|
||||
${config.services.postgresql.package}/bin/pg_dumpall --clean \
|
||||
| ${lib.getExe pkgs.gzip} --rsyncable \
|
||||
> /tmp/postgresql-dump.sql.gz
|
||||
'';
|
||||
|
||||
backupCleanupCommand = ''
|
||||
rm /tmp/postgresql-dump.sql.gz
|
||||
'';
|
||||
};
|
||||
backupCleanupCommand = ''
|
||||
rm /tmp/postgresql-dump.sql.gz
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue