Added basic rsnapshot backup.
This commit is contained in:
parent
82823a4085
commit
59b1fafefc
2 changed files with 119 additions and 0 deletions
60
default.nix
60
default.nix
|
@ -363,9 +363,69 @@ in
|
|||
Runs a local DNS resolver (kresd) as recommended when running rspamd. This prevents your log file from filling up with rspamd_monitored_dns_mon entries.
|
||||
'';
|
||||
};
|
||||
|
||||
backup = {
|
||||
enable = mkEnableOption "backup via rsnapshot";
|
||||
|
||||
snapshotRoot = mkOption {
|
||||
type = types.path;
|
||||
default = "/var/rsnapshot";
|
||||
description = ''
|
||||
The directory where rsnapshot stores the backup.
|
||||
'';
|
||||
};
|
||||
|
||||
cmdPreexec = mkOption {
|
||||
type = types.nullOr types.string;
|
||||
default = null;
|
||||
description = ''
|
||||
The command to be executed before each backup operation. This is wrapped in a shell script to be called by rsnapshot.
|
||||
'';
|
||||
};
|
||||
|
||||
cmdPostexec = mkOption {
|
||||
type = types.nullOr types.string;
|
||||
default = null;
|
||||
description = "The command to be executed after each backup operation. This is wrapped in a shell script to be called by rsnapshot.";
|
||||
};
|
||||
|
||||
retain = {
|
||||
hourly = mkOption {
|
||||
type = types.int;
|
||||
default = 24;
|
||||
description = "How many hourly snapshots are retained.";
|
||||
};
|
||||
daily = mkOption {
|
||||
type = types.int;
|
||||
default = 7;
|
||||
description = "How many daily snapshots are retained.";
|
||||
};
|
||||
weekly = mkOption {
|
||||
type = types.int;
|
||||
default = 54;
|
||||
description = "How many weekly snapshots are retained.";
|
||||
};
|
||||
};
|
||||
|
||||
cronIntervals = mkOption {
|
||||
type = types.attrsOf types.string;
|
||||
default = {
|
||||
# minute, hour, day-in-month, month, weekday (0 = sunday)
|
||||
hourly = " 0 * * * *"; # Every full hour
|
||||
daily = "30 3 * * *"; # Every day at 3:30
|
||||
weekly = " 0 5 * * 0"; # Every sunday at 5:00 AM
|
||||
};
|
||||
description = ''
|
||||
Periodicity at which intervals should be run by cron.
|
||||
Note that the intervals also have to exist in configuration
|
||||
as retain options.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
imports = [
|
||||
./mail-server/rsnapshot.nix
|
||||
./mail-server/clamav.nix
|
||||
./mail-server/users.nix
|
||||
./mail-server/environment.nix
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue