selfhostblocks/modules/contracts/backup.nix
Pierre Penninckx 431dd058c5
Backup contracts for files and databases (#344)
This PR continues the work started in
https://github.com/ibizaman/selfhostblocks/pull/314

I had to create my own PR since I couldn't add commits on the fork.

---------

Co-authored-by: sivertism <10866270+sivertism@users.noreply.github.com>
2024-11-12 20:40:52 +00:00

60 lines
1.4 KiB
Nix

{ lib, ... }:
let
inherit (lib) mkOption;
inherit (lib.types) anything listOf nonEmptyListOf submodule str;
in
{
request = submodule {
options = {
user = mkOption {
description = "Unix user doing the backups.";
type = str;
};
sourceDirectories = mkOption {
description = "Directories to backup.";
type = nonEmptyListOf str;
};
excludePatterns = mkOption {
description = "Patterns to exclude.";
type = listOf str;
default = [];
};
hooks = mkOption {
description = "Hooks to run around the backup.";
default = {};
type = submodule {
options = {
before_backup = mkOption {
description = "Hooks to run before backup";
type = listOf str;
default = [];
};
after_backup = mkOption {
description = "Hooks to run after backup";
type = listOf str;
default = [];
};
};
};
};
};
};
result = submodule {
options = {
restoreScript = mkOption {
description = "Name of script that can restore the database.";
type = str;
};
backupService = mkOption {
description = "Name of service backing up the database.";
type = str;
};
};
};
}