mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 17:31:34 +01:00
Rename option "backups.enable" to "doBackups"
This commit is contained in:
parent
6bd3313e55
commit
4f5db50ca1
11 changed files with 71 additions and 92 deletions
|
|
@ -9,18 +9,20 @@ let
|
|||
|
||||
user = config.users.users.nextcloud.name;
|
||||
dataDir = config.services.nextcloud.home;
|
||||
|
||||
nextcloud-occ = lib.getExe' config.services.nextcloud.occ "nextcloud-occ";
|
||||
in
|
||||
{
|
||||
options.custom.services.nextcloud.backups.enable = lib.mkEnableOption "";
|
||||
options.custom.services.nextcloud.doBackups = lib.mkEnableOption "";
|
||||
|
||||
config = lib.mkIf cfg.backups.enable {
|
||||
config = lib.mkIf cfg.doBackups {
|
||||
custom.services.resticBackups.nextcloud = {
|
||||
extraConfig = {
|
||||
backupPrepareCommand = ''
|
||||
${lib.getExe' config.services.nextcloud.occ "nextcloud-occ"} maintenance:mode --on
|
||||
${nextcloud-occ} maintenance:mode --on
|
||||
${lib.getExe pkgs.sudo} --user=${user} ${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";
|
||||
backupCleanupCommand = "${nextcloud-occ} maintenance:mode --off";
|
||||
paths = [
|
||||
"${dataDir}/data"
|
||||
"${dataDir}/config/config.php"
|
||||
|
|
@ -29,10 +31,10 @@ in
|
|||
};
|
||||
|
||||
restoreCommand = {
|
||||
preRestore = "${lib.getExe' config.services.nextcloud.occ "nextcloud-occ"} maintenance:mode --on";
|
||||
preRestore = "${nextcloud-occ} maintenance:mode --on";
|
||||
postRestore = ''
|
||||
sudo --user=${user} pg_restore --clean --if-exists --dbname nextcloud ${dataDir}/db.dump
|
||||
${lib.getExe' config.services.nextcloud.occ "nextcloud-occ"} maintenance:mode --off
|
||||
${nextcloud-occ} maintenance:mode --off
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue