diff --git a/nixos/modules/system/boot/systemd-unit-options.nix b/nixos/modules/system/boot/systemd-unit-options.nix index 4154389b2ce5fb..78f0d0f9e01ff1 100644 --- a/nixos/modules/system/boot/systemd-unit-options.nix +++ b/nixos/modules/system/boot/systemd-unit-options.nix @@ -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 + systemd.timer + 5. This is equivalent to adding a + corresponding timer unit with set to the + value given here. + ''; + }; + }; diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index d4ae4c93468f4a..6b914bb5bd2857 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -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); @@ -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);