mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-02-07 12:19:07 +00:00
services/yt-dlp: add job persistence
This commit is contained in:
parent
2526e552db
commit
e9c2c3d226
@ -23,7 +23,8 @@ let
|
||||
startAt = lib.mkOption {
|
||||
type = with lib.types; str;
|
||||
description = ''
|
||||
Indicates how frequent the download will occur. The given schedule should follow the format as described from
|
||||
Indicates how frequent the download will occur. The given schedule
|
||||
should follow the format as described from
|
||||
<citerefentry>
|
||||
<refentrytitle>systemd.time</refentrytitle>
|
||||
<manvolnum>5</manvolnum>
|
||||
@ -33,6 +34,18 @@ let
|
||||
example = "*-*-3/4";
|
||||
};
|
||||
|
||||
persistent = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
description = ''
|
||||
Indicates whether the service will start if timer has missed.
|
||||
Defaults to <literal>true</literal> since this module mainly assumes
|
||||
it is used on the desktop.
|
||||
'';
|
||||
default = true;
|
||||
defaultText = "true";
|
||||
example = "false";
|
||||
};
|
||||
|
||||
extraArgs = lib.mkOption {
|
||||
type = with lib.types; listOf str;
|
||||
description =
|
||||
@ -155,7 +168,8 @@ in {
|
||||
|
||||
Timer = {
|
||||
OnCalendar = value.startAt;
|
||||
Persistent = true;
|
||||
RandomizedDelaySec = "2min";
|
||||
Persistent = value.persistent;
|
||||
};
|
||||
|
||||
Install.WantedBy = [ "timers.target" ];
|
||||
|
@ -23,7 +23,8 @@ let
|
||||
startAt = lib.mkOption {
|
||||
type = with lib.types; str;
|
||||
description = ''
|
||||
Indicates how frequent the download will occur. The given schedule should follow the format as described from
|
||||
Indicates how frequent the download will occur. The given schedule
|
||||
should follow the format as described from
|
||||
<citerefentry>
|
||||
<refentrytitle>systemd.time</refentrytitle>
|
||||
<manvolnum>5</manvolnum>
|
||||
@ -33,6 +34,17 @@ let
|
||||
example = "*-*-3/4";
|
||||
};
|
||||
|
||||
persistent = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
description = ''
|
||||
Indicates whether the job should be persistent, starting the service
|
||||
if missed.
|
||||
'';
|
||||
default = false;
|
||||
defaultText = "false";
|
||||
example = "true";
|
||||
};
|
||||
|
||||
extraArgs = lib.mkOption {
|
||||
type = with lib.types; listOf str;
|
||||
description =
|
||||
@ -145,5 +157,13 @@ in {
|
||||
SystemCallErrorNumber = "EPERM";
|
||||
};
|
||||
}) cfg.jobs;
|
||||
|
||||
systemd.timers = lib.mapAttrs' (name: value:
|
||||
lib.nameValuePair "yt-dlp-archive-service-${name}" {
|
||||
timerConfig = {
|
||||
Persistent = value.persistent;
|
||||
RandomizedDelaySec = "2min";
|
||||
};
|
||||
}) cfg.jobs;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user