services/gallery-dl: add job persistence

This commit is contained in:
Gabriel Arazas 2022-07-21 09:54:36 +08:00
parent e9c2c3d226
commit d9811b1d84
2 changed files with 33 additions and 1 deletions

View File

@ -39,6 +39,18 @@ let
example = "*-*-3/4"; example = "*-*-3/4";
}; };
persistent = lib.mkOption {
type = lib.types.bool;
description = ''
Indicates whether job is persistent, starting the service despite the
timer missed. Defaults to <literal>true</literal> assuming it is used
on the desktop.
'';
default = true;
defaultText = "true";
example = "false";
};
extraArgs = lib.mkOption { extraArgs = lib.mkOption {
type = with lib.types; listOf str; type = with lib.types; listOf str;
description = '' description = ''
@ -185,7 +197,8 @@ in {
Timer = { Timer = {
OnCalendar = value.startAt; OnCalendar = value.startAt;
Persistent = true; Persistent = value.persistent;
RandomizedDelaySec = "2min";
}; };
Install.WantedBy = [ "timers.target" ]; Install.WantedBy = [ "timers.target" ];

View File

@ -38,6 +38,17 @@ let
example = "*-*-3/4"; example = "*-*-3/4";
}; };
persistent = lib.mkOption {
type = lib.types.bool;
description = ''
Indicates whether job is persistent, starting the service despite the
timer missed.
'';
default = false;
defaultText = "false";
example = "true";
};
extraArgs = lib.mkOption { extraArgs = lib.mkOption {
type = with lib.types; listOf str; type = with lib.types; listOf str;
description = '' description = ''
@ -195,5 +206,13 @@ in {
SystemCallErrorNumber = "EPERM"; SystemCallErrorNumber = "EPERM";
}; };
}) cfg.jobs; }) cfg.jobs;
systemd.timers = lib.mapAttrs' (name: value:
lib.nameValuePair "gallery-dl-archive-service-${name}" {
timerConfig = {
Persistent = value.persistent;
RandomizedDelaySec = "2min";
};
}) cfg.jobs;
}; };
} }