diff --git a/CHANGELOG.md b/CHANGELOG.md index bf078b8..60c1b7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,11 @@ Template: # Upcoming Release +## Breaking Changes + +- Options `before_backup` and `after_backup` for backup contract have been renamed to + `beforeBackup` and `afterBackup`. + ## Other Changes - Show how to pin Self Host Blocks flake input to a tag. diff --git a/docs/redirects.json b/docs/redirects.json index c183e12..4cbae29 100644 --- a/docs/redirects.json +++ b/docs/redirects.json @@ -188,11 +188,11 @@ "blocks-restic-options-shb.restic.instances._name_.request.hooks": [ "blocks-restic.html#blocks-restic-options-shb.restic.instances._name_.request.hooks" ], - "blocks-restic-options-shb.restic.instances._name_.request.hooks.after_backup": [ - "blocks-restic.html#blocks-restic-options-shb.restic.instances._name_.request.hooks.after_backup" + "blocks-restic-options-shb.restic.instances._name_.request.hooks.afterBackup": [ + "blocks-restic.html#blocks-restic-options-shb.restic.instances._name_.request.hooks.afterBackup" ], - "blocks-restic-options-shb.restic.instances._name_.request.hooks.before_backup": [ - "blocks-restic.html#blocks-restic-options-shb.restic.instances._name_.request.hooks.before_backup" + "blocks-restic-options-shb.restic.instances._name_.request.hooks.beforeBackup": [ + "blocks-restic.html#blocks-restic-options-shb.restic.instances._name_.request.hooks.beforeBackup" ], "blocks-restic-options-shb.restic.instances._name_.request.sourceDirectories": [ "blocks-restic.html#blocks-restic-options-shb.restic.instances._name_.request.sourceDirectories" @@ -581,11 +581,11 @@ "contracts-backup-options-shb.contracts.backup.request.hooks": [ "contracts-backup.html#contracts-backup-options-shb.contracts.backup.request.hooks" ], - "contracts-backup-options-shb.contracts.backup.request.hooks.after_backup": [ - "contracts-backup.html#contracts-backup-options-shb.contracts.backup.request.hooks.after_backup" + "contracts-backup-options-shb.contracts.backup.request.hooks.afterBackup": [ + "contracts-backup.html#contracts-backup-options-shb.contracts.backup.request.hooks.afterBackup" ], - "contracts-backup-options-shb.contracts.backup.request.hooks.before_backup": [ - "contracts-backup.html#contracts-backup-options-shb.contracts.backup.request.hooks.before_backup" + "contracts-backup-options-shb.contracts.backup.request.hooks.beforeBackup": [ + "contracts-backup.html#contracts-backup-options-shb.contracts.backup.request.hooks.beforeBackup" ], "contracts-backup-options-shb.contracts.backup.request.sourceDirectories": [ "contracts-backup.html#contracts-backup-options-shb.contracts.backup.request.sourceDirectories" @@ -857,11 +857,11 @@ "services-forgejo-options-shb.forgejo.backup.hooks": [ "services-forgejo.html#services-forgejo-options-shb.forgejo.backup.hooks" ], - "services-forgejo-options-shb.forgejo.backup.hooks.after_backup": [ - "services-forgejo.html#services-forgejo-options-shb.forgejo.backup.hooks.after_backup" + "services-forgejo-options-shb.forgejo.backup.hooks.afterBackup": [ + "services-forgejo.html#services-forgejo-options-shb.forgejo.backup.hooks.afterBackup" ], - "services-forgejo-options-shb.forgejo.backup.hooks.before_backup": [ - "services-forgejo.html#services-forgejo-options-shb.forgejo.backup.hooks.before_backup" + "services-forgejo-options-shb.forgejo.backup.hooks.beforeBackup": [ + "services-forgejo.html#services-forgejo-options-shb.forgejo.backup.hooks.beforeBackup" ], "services-forgejo-options-shb.forgejo.backup.sourceDirectories": [ "services-forgejo.html#services-forgejo-options-shb.forgejo.backup.sourceDirectories" @@ -1331,11 +1331,11 @@ "services-nextcloudserver-options-shb.nextcloud.backup.hooks": [ "services-nextcloud.html#services-nextcloudserver-options-shb.nextcloud.backup.hooks" ], - "services-nextcloudserver-options-shb.nextcloud.backup.hooks.after_backup": [ - "services-nextcloud.html#services-nextcloudserver-options-shb.nextcloud.backup.hooks.after_backup" + "services-nextcloudserver-options-shb.nextcloud.backup.hooks.afterBackup": [ + "services-nextcloud.html#services-nextcloudserver-options-shb.nextcloud.backup.hooks.afterBackup" ], - "services-nextcloudserver-options-shb.nextcloud.backup.hooks.before_backup": [ - "services-nextcloud.html#services-nextcloudserver-options-shb.nextcloud.backup.hooks.before_backup" + "services-nextcloudserver-options-shb.nextcloud.backup.hooks.beforeBackup": [ + "services-nextcloud.html#services-nextcloudserver-options-shb.nextcloud.backup.hooks.beforeBackup" ], "services-nextcloudserver-options-shb.nextcloud.backup.sourceDirectories": [ "services-nextcloud.html#services-nextcloudserver-options-shb.nextcloud.backup.sourceDirectories" @@ -1481,11 +1481,11 @@ "services-vaultwarden-options-shb.vaultwarden.backup.hooks": [ "services-vaultwarden.html#services-vaultwarden-options-shb.vaultwarden.backup.hooks" ], - "services-vaultwarden-options-shb.vaultwarden.backup.hooks.after_backup": [ - "services-vaultwarden.html#services-vaultwarden-options-shb.vaultwarden.backup.hooks.after_backup" + "services-vaultwarden-options-shb.vaultwarden.backup.hooks.afterBackup": [ + "services-vaultwarden.html#services-vaultwarden-options-shb.vaultwarden.backup.hooks.afterBackup" ], - "services-vaultwarden-options-shb.vaultwarden.backup.hooks.before_backup": [ - "services-vaultwarden.html#services-vaultwarden-options-shb.vaultwarden.backup.hooks.before_backup" + "services-vaultwarden-options-shb.vaultwarden.backup.hooks.beforeBackup": [ + "services-vaultwarden.html#services-vaultwarden-options-shb.vaultwarden.backup.hooks.beforeBackup" ], "services-vaultwarden-options-shb.vaultwarden.backup.sourceDirectories": [ "services-vaultwarden.html#services-vaultwarden-options-shb.vaultwarden.backup.sourceDirectories" diff --git a/modules/blocks/borgbackup.nix b/modules/blocks/borgbackup.nix index ebf0a04..331bab6 100644 --- a/modules/blocks/borgbackup.nix +++ b/modules/blocks/borgbackup.nix @@ -90,13 +90,13 @@ let default = {}; type = lib.types.submodule { options = { - before_backup = lib.mkOption { + beforeBackup = lib.mkOption { description = "Hooks to run before backup"; type = lib.types.listOf lib.types.str; default = []; }; - after_backup = lib.mkOption { + afterBackup = lib.mkOption { description = "Hooks to run after backup"; type = lib.types.listOf lib.types.str; default = []; @@ -279,11 +279,11 @@ in lib.attrsets.mapAttrsToList mkCheck instance.consistency; # hooks = lib.mkMerge [ - # lib.optionalAttrs (builtins.length instance.hooks.before_backup > 0) { - # inherit (instance.hooks) before_backup; + # lib.optionalAttrs (builtins.length instance.hooks.beforeBackup > 0) { + # inherit (instance.hooks) beforeBackup; # } - # lib.optionalAttrs (builtins.length instance.hooks.after_backup > 0) { - # inherit (instance.hooks) after_backup; + # lib.optionalAttrs (builtins.length instance.hooks.afterBackup > 0) { + # inherit (instance.hooks) afterBackup; # } # ]; }; diff --git a/modules/blocks/restic.nix b/modules/blocks/restic.nix index 0f51fb5..314d9ff 100644 --- a/modules/blocks/restic.nix +++ b/modules/blocks/restic.nix @@ -272,9 +272,9 @@ in "--${builtins.replaceStrings ["_"] ["-"] name} ${builtins.toString value}" ) instance.settings.retention; - backupPrepareCommand = concatStringsSep "\n" instance.request.hooks.before_backup; + backupPrepareCommand = concatStringsSep "\n" instance.request.hooks.beforeBackup; - backupCleanupCommand = concatStringsSep "\n" instance.request.hooks.after_backup; + backupCleanupCommand = concatStringsSep "\n" instance.request.hooks.afterBackup; extraBackupArgs = (optionals (instance.settings.limitUploadKiBs != null) [ diff --git a/modules/contracts/backup.nix b/modules/contracts/backup.nix index 1422dbb..74040d9 100644 --- a/modules/contracts/backup.nix +++ b/modules/contracts/backup.nix @@ -29,13 +29,13 @@ in default = {}; type = submodule { options = { - before_backup = mkOption { + beforeBackup = mkOption { description = "Hooks to run before backup."; type = listOf str; default = []; }; - after_backup = mkOption { + afterBackup = mkOption { description = "Hooks to run after backup."; type = listOf str; default = []; diff --git a/test/blocks/restic.nix b/test/blocks/restic.nix index a5406bd..9ec4a0c 100644 --- a/test/blocks/restic.nix +++ b/test/blocks/restic.nix @@ -69,7 +69,7 @@ let "/opt/files/B" ]; - hooks.before_backup = ['' + hooks.beforeBackup = ['' echo $RUNTIME_DIRECTORY if [ "$RUNTIME_DIRECTORY" = /run/restic-backups-testinstance_opt_repos_A ]; then if ! [ -f /run/secrets_restic/restic-backups-testinstance_opt_repos_A ]; then