mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
rsnapshot module: Enable manual rsnapshot usage with module config.
This commit is contained in:
parent
3f35d670de
commit
1e2ec5817c
1 changed files with 16 additions and 4 deletions
|
@ -20,6 +20,12 @@ in
|
||||||
options = {
|
options = {
|
||||||
services.rsnapshot = {
|
services.rsnapshot = {
|
||||||
enable = mkEnableOption "rsnapshot backups";
|
enable = mkEnableOption "rsnapshot backups";
|
||||||
|
enableManualRsnapshot = mkOption {
|
||||||
|
description = "Whether to enable manual usage of the rsnapshot command with this module.";
|
||||||
|
default = true;
|
||||||
|
example = false;
|
||||||
|
type = types.bool;
|
||||||
|
};
|
||||||
|
|
||||||
extraConfig = mkOption {
|
extraConfig = mkOption {
|
||||||
default = "";
|
default = "";
|
||||||
|
@ -54,8 +60,14 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable (mkMerge [
|
||||||
services.cron.systemCronJobs =
|
{
|
||||||
mapAttrsToList (interval: time: "${time} root ${pkgs.rsnapshot}/bin/rsnapshot -c ${cfgfile} ${interval}") cfg.cronIntervals;
|
services.cron.systemCronJobs =
|
||||||
};
|
mapAttrsToList (interval: time: "${time} root ${pkgs.rsnapshot}/bin/rsnapshot -c ${cfgfile} ${interval}") cfg.cronIntervals;
|
||||||
|
}
|
||||||
|
(mkIf cfg.enableManualRsnapshot {
|
||||||
|
environment.systemPackages = [ pkgs.rsnapshot ];
|
||||||
|
environment.etc."rsnapshot.conf".source = cfgfile;
|
||||||
|
})
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue