mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 21:01:34 +01:00
Modularize the backup configuration
This commit is contained in:
parent
e333333914
commit
40a8ba846a
4 changed files with 101 additions and 88 deletions
|
|
@ -6,49 +6,26 @@
|
|||
...
|
||||
}:
|
||||
{
|
||||
sops.secrets = {
|
||||
"restic/environment" = {
|
||||
owner = config.users.users.nextcloud.name;
|
||||
inherit (config.users.users.nextcloud) group;
|
||||
};
|
||||
"restic/password" = {
|
||||
owner = config.users.users.nextcloud.name;
|
||||
inherit (config.users.users.nextcloud) group;
|
||||
};
|
||||
};
|
||||
systemd.tmpfiles.rules = [ "d ${dataDir}/backup 700 nextcloud nextcloud -" ];
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"d ${dataDir}/backup 700 nextcloud nextcloud -"
|
||||
"d /var/cache/restic-backups-nextcloud 700 nextcloud nextcloud -"
|
||||
];
|
||||
|
||||
services.restic.backups.nextcloud = {
|
||||
initialize = true;
|
||||
myConfig.resticBackup.nextcloud = {
|
||||
enable = true;
|
||||
user = config.users.users.nextcloud.name;
|
||||
|
||||
repository = "s3:https://s3.eu-central-003.backblazeb2.com/stork-atlas/nextcloud";
|
||||
environmentFile = config.sops.secrets."restic/environment".path;
|
||||
passwordFile = config.sops.secrets."restic/password".path;
|
||||
|
||||
pruneOpts = [
|
||||
"--keep-daily 7"
|
||||
"--keep-weekly 5"
|
||||
"--keep-monthly 6"
|
||||
"--keep-yearly 1"
|
||||
];
|
||||
|
||||
backupPrepareCommand = ''
|
||||
${lib.getExe' config.services.nextcloud.occ "nextcloud-occ"} maintenance:mode --on
|
||||
${lib.getExe' config.services.postgresql.package "pg_dump"} nextcloud --format=custom --file=${dataDir}/backup/db.dump
|
||||
'';
|
||||
backupCleanupCommand = ''
|
||||
${lib.getExe' config.services.nextcloud.occ "nextcloud-occ"} maintenance:mode --off
|
||||
'';
|
||||
paths = [
|
||||
"${dataDir}/home/data"
|
||||
"${dataDir}/home/config/config.php"
|
||||
"${dataDir}/backup"
|
||||
];
|
||||
extraConfig = {
|
||||
backupPrepareCommand = ''
|
||||
${lib.getExe' config.services.nextcloud.occ "nextcloud-occ"} maintenance:mode --on
|
||||
${lib.getExe' config.services.postgresql.package "pg_dump"} nextcloud --format=custom --file=${dataDir}/backup/db.dump
|
||||
'';
|
||||
backupCleanupCommand = ''
|
||||
${lib.getExe' config.services.nextcloud.occ "nextcloud-occ"} maintenance:mode --off
|
||||
'';
|
||||
paths = [
|
||||
"${dataDir}/home/data"
|
||||
"${dataDir}/home/config/config.php"
|
||||
"${dataDir}/backup"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue