mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 15:11:34 +01:00
Remove nextcloud backup dir
This commit is contained in:
parent
91d75bd4cb
commit
7a54ebe5d1
1 changed files with 3 additions and 7 deletions
|
|
@ -8,16 +8,12 @@ let
|
|||
cfg = config.myConfig.nextcloud;
|
||||
|
||||
dataDir = config.services.nextcloud.home;
|
||||
|
||||
user = config.users.users.nextcloud.name;
|
||||
inherit (config.users.users.nextcloud) group;
|
||||
in
|
||||
{
|
||||
options.myConfig.nextcloud.backups.enable = lib.mkEnableOption "";
|
||||
|
||||
config = lib.mkIf cfg.backups.enable {
|
||||
systemd.tmpfiles.rules = [ "d ${dataDir}/backup 700 ${user} ${group} -" ];
|
||||
|
||||
myConfig.resticBackup.nextcloud = {
|
||||
inherit user;
|
||||
healthchecks.enable = true;
|
||||
|
|
@ -25,13 +21,13 @@ in
|
|||
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
|
||||
${lib.getExe' config.services.postgresql.package "pg_dump"} nextcloud --format=custom --file=${dataDir}/db.dump
|
||||
'';
|
||||
backupCleanupCommand = "${lib.getExe' config.services.nextcloud.occ "nextcloud-occ"} maintenance:mode --off";
|
||||
paths = [
|
||||
"${dataDir}/data"
|
||||
"${dataDir}/config/config.php"
|
||||
"${dataDir}/backup"
|
||||
"${dataDir}/db.dump"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
|
@ -43,7 +39,7 @@ in
|
|||
sudo --user=${user} bash -c "
|
||||
${lib.getExe' config.services.nextcloud.occ "nextcloud-occ"} maintenance:mode --on
|
||||
restic-nextcloud restore latest --target /
|
||||
pg_restore --clean --if-exists --dbname nextcloud ${dataDir}/backup/db.dump
|
||||
pg_restore --clean --if-exists --dbname nextcloud ${dataDir}/db.dump
|
||||
${lib.getExe' config.services.nextcloud.occ "nextcloud-occ"} maintenance:mode --off
|
||||
"
|
||||
'';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue