Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(nixos/systemd): Add Persistent for services. #123158

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions nixos/modules/system/boot/systemd-unit-options.nix
Expand Up @@ -371,6 +371,21 @@ in rec {
apply = v: if isList v then v else [ v ];
};

persistent = mkOption {
type = types.bool;
default = false;
example = "true";
description = ''
When the timer is activated, trigger immediately if the timer would have
triggered at least once while the timer was inactive. Can be useful to
trigger missed runs of a service while the system was powered down. See
<citerefentry><refentrytitle>systemd.timer</refentrytitle>
<manvolnum>5</manvolnum></citerefentry>. This is equivalent to adding a
corresponding timer unit with <option>Persistent</option> set to the
value given here.
'';
};

};


Expand Down
2 changes: 2 additions & 0 deletions nixos/modules/system/boot/systemd.nix
Expand Up @@ -1134,6 +1134,7 @@ in
mapAttrs (name: service:
{ wantedBy = [ "timers.target" ];
timerConfig.OnCalendar = service.startAt;
timerConfig.Persistent = service.persistent;
})
(filterAttrs (name: service: service.enable && service.startAt != []) cfg.services);

Expand All @@ -1142,6 +1143,7 @@ in
mapAttrs (name: service:
{ wantedBy = [ "timers.target" ];
timerConfig.OnCalendar = service.startAt;
timerConfig.Persistent = service.persistent;
})
(filterAttrs (name: service: service.startAt != []) cfg.user.services);

Expand Down