diff options
| author | Emily <vcs@emily.moe> | 2024-06-15 09:40:58 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-15 09:40:58 +0100 |
| commit | 58b905ea87674592aa84c37873e6c07bc3807aba (patch) | |
| tree | 23afd590a6cd9d6b947d56aa183a35795f3b69e2 /modules/launchd/launchd.nix | |
| parent | 801f8ab2bcd03a90a751370bf91e83068414c5b0 (diff) | |
| parent | 861af0fc94df9454f4e92d6892f75588763164bb (diff) | |
Merge pull request #716 from tmillr/fix-launchd-calendar-interval
fix(launchd): improve `StartCalendarInterval`
Diffstat (limited to 'modules/launchd/launchd.nix')
| -rw-r--r-- | modules/launchd/launchd.nix | 65 |
1 files changed, 17 insertions, 48 deletions
diff --git a/modules/launchd/launchd.nix b/modules/launchd/launchd.nix index 9e13a3b..9eabf0a 100644 --- a/modules/launchd/launchd.nix +++ b/modules/launchd/launchd.nix @@ -2,6 +2,10 @@ with lib; +let + launchdTypes = import ./types.nix { inherit config lib; }; +in + { options = { Label = mkOption { @@ -344,55 +348,21 @@ with lib; default = null; example = [{ Hour = 2; Minute = 30; }]; description = '' - This optional key causes the job to be started every calendar interval as specified. Missing arguments - are considered to be wildcard. The semantics are much like `crontab(5)`. Unlike cron which skips job - invocations when the computer is asleep, launchd will start the job the next time the computer wakes + This optional key causes the job to be started every calendar interval as specified. The semantics are + much like {manpage}`crontab(5)`: Missing attributes are considered to be wildcard. Unlike cron which skips + job invocations when the computer is asleep, launchd will start the job the next time the computer wakes up. If multiple intervals transpire before the computer is woken, those events will be coalesced into - one event upon wake from sleep. - ''; - type = types.nullOr (types.listOf (types.submodule { - options = { - Minute = mkOption { - type = types.nullOr types.int; - default = null; - description = '' - The minute on which this job will be run. - ''; - }; - - Hour = mkOption { - type = types.nullOr types.int; - default = null; - description = '' - The hour on which this job will be run. - ''; - }; - - Day = mkOption { - type = types.nullOr types.int; - default = null; - description = '' - The day on which this job will be run. - ''; - }; + one event upon waking from sleep. - Weekday = mkOption { - type = types.nullOr types.int; - default = null; - description = '' - The weekday on which this job will be run (0 and 7 are Sunday). - ''; - }; + ::: {.important} + The list must not be empty and must not contain duplicate entries (attrsets which compare equally). + ::: - Month = mkOption { - type = types.nullOr types.int; - default = null; - description = '' - The month on which this job will be run. - ''; - }; - }; - })); + ::: {.caution} + Since missing attrs become wildcards, an empty attrset effectively means "every minute". + ::: + ''; + type = types.nullOr launchdTypes.StartCalendarInterval; }; StandardInPath = mkOption { @@ -895,6 +865,5 @@ with lib; }; }; - config = { - }; + config = {}; } |
