feat(django-apps): Add timers option

This is similar to extraServices but without the partOf, upheldBy and
wantedBy settings.
This commit is contained in:
Tom Hubrecht 2025-02-24 16:03:01 +01:00
parent 80ede4b1f6
commit 09ffafade0
Signed by: thubrecht
SSH key fingerprint: SHA256:r+nK/SIcWlJ0zFZJGHtlAoRwq1Rm+WcKAm5ADYMoQPc

View file

@ -322,6 +322,15 @@ in
Extra services to run in parallel of the application.
May be used to run background tasks and/or workers.
'';
timers = mkOption {
type = attrs;
default = { };
description = ''
Extra oneshot services to run in parallel of the application.
Be aware that `startAt` should be included.
'';
};
};
manageScript = mkOption {
@ -805,6 +814,28 @@ in
} serviceContent
)
) config.extraServices)
// (mapAttrs' (
serviceName: serviceContent:
nameValuePair "dj-${name}_${serviceName}" (
recursiveUpdate {
inherit after environment path;
serviceConfig = {
inherit
Group
LoadCredential
RuntimeDirectory
StateDirectory
UMask
User
;
WorkingDirectory = "/var/lib/django-apps/${name}/source";
DynamicUser = true;
};
} serviceContent
)
) config.timers)
) cfg.sites);
};