1
Fork 0
mirror of https://github.com/RGBCube/ncc synced 2025-07-31 20:17:45 +00:00

Use a single Restic repository for a whole host

This commit is contained in:
RGBCube 2024-04-30 12:56:08 +03:00
parent b3a23637f9
commit 1eb906e040
No known key found for this signature in database

View file

@ -3,9 +3,8 @@
systemConfiguration { systemConfiguration {
secrets.resticPassword.file = ./password.age; secrets.resticPassword.file = ./password.age;
services.restic.backups = let services.restic.backups.disk = {
defaultConfig = name: { repository = "sftp:backup@disk:${config.networking.hostName}-backup";
repository = "sftp:backup@disk:${config.networking.hostName}-${name}";
passwordFile = config.secrets.resticPassword.path; passwordFile = config.secrets.resticPassword.path;
initialize = true; initialize = true;
@ -20,10 +19,10 @@ systemConfiguration {
OnCalendar = "daily"; OnCalendar = "daily";
Persistent = true; Persistent = true;
}; };
};
in { paths = [
general = (defaultConfig "general") // { "/tmp/postgresql-dump.sql.gz"
paths = map (dir: "/var/lib/${dir}") [ ] ++ map (dir: "/var/lib/${dir}") [
"dkim" "dkim"
"forgejo" "forgejo"
"gitea-runner" "gitea-runner"
@ -34,10 +33,6 @@ systemConfiguration {
"nextcloud" "nextcloud"
"postfix" "postfix"
]; ];
};
postgresql = (defaultConfig "postgresql") // {
paths = [ "/tmp/postgresql-dump.sql.gz" ];
backupPrepareCommand = '' backupPrepareCommand = ''
${config.services.postgresql.package}/bin/pg_dumpall --clean \ ${config.services.postgresql.package}/bin/pg_dumpall --clean \
@ -49,5 +44,4 @@ systemConfiguration {
rm /tmp/postgresql-dump.sql.gz rm /tmp/postgresql-dump.sql.gz
''; '';
}; };
};
} }