mirror of
https://codeberg.org/icewind/tasmota-backup.git
synced 2026-06-03 14:24:08 +02:00
timer
This commit is contained in:
parent
333e23d329
commit
6081cf31ec
1 changed files with 18 additions and 1 deletions
19
module.nix
19
module.nix
|
|
@ -54,6 +54,12 @@ in {
|
||||||
description = "File containing the device password";
|
description = "File containing the device password";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
interval = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "daily";
|
||||||
|
description = "Interval to run the backup";
|
||||||
|
};
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
defaultText = literalExpression "pkgs.tasproxy";
|
defaultText = literalExpression "pkgs.tasproxy";
|
||||||
|
|
@ -63,7 +69,7 @@ in {
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
systemd.services."tasmota-backup" = {
|
systemd.services."tasmota-backup" = {
|
||||||
wantedBy = ["multi-user.target"];
|
description = "Backup tasmota configurations";
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = "${cfg.package}/bin/tasmota-backup ${configFile}";
|
ExecStart = "${cfg.package}/bin/tasmota-backup ${configFile}";
|
||||||
|
|
@ -96,5 +102,16 @@ in {
|
||||||
RestrictSUIDSGID = true;
|
RestrictSUIDSGID = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
systemd.timers."tasmota-backup" = {
|
||||||
|
inherit (config.systemd.services."tasmota-backup") description;
|
||||||
|
|
||||||
|
enable = true;
|
||||||
|
wantedBy = ["multi-user.target"];
|
||||||
|
timerConfig = {
|
||||||
|
OnCalendar = cfg.interval;
|
||||||
|
RandomizedDelaySec = "15m";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue