From e91ffd0ff39513387a2cd2e23f55c63eb84c0d62 Mon Sep 17 00:00:00 2001 From: Daiderd Jordan Date: Wed, 14 Dec 2016 21:03:27 +0100 Subject: [PATCH] add KeepAlive submodule for launchd..serviceConfig --- modules/launchd/launchd.nix | 48 ++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/modules/launchd/launchd.nix b/modules/launchd/launchd.nix index 8bf7ebb..9dd88cf 100644 --- a/modules/launchd/launchd.nix +++ b/modules/launchd/launchd.nix @@ -150,7 +150,53 @@ with lib; }; KeepAlive = mkOption { - type = types.nullOr types.bool; + type = types.nullOr (types.either types.bool (types.submodule { + options = { + + SuccessfulExit = mkOption { + type = types.nullOr types.bool; + default = null; + description = '' + If true, the job will be restarted as long as the program exits and with an exit status of zero. + If false, the job will be restarted in the inverse condition. This key implies that "RunAtLoad" + is set to true, since the job needs to run at least once before we can get an exit status. + ''; + }; + + NetworkState = mkOption { + type = types.nullOr types.bool; + default = null; + description = '' + If true, the job will be kept alive as long as the network is up, where up is defined as at least + one non-loopback interface being up and having IPv4 or IPv6 addresses assigned to them. If + false, the job will be kept alive in the inverse condition. + ''; + }; + + PathState = mkOption { + type = types.nullOr (types.attrsOf types.bool); + default = null; + description = '' + Each key in this dictionary is a file-system path. If the value of the key is true, then the job + will be kept alive as long as the path exists. If false, the job will be kept alive in the + inverse condition. The intent of this feature is that two or more jobs may create semaphores in + the file-system namespace. + ''; + }; + + OtherJobEnabled = mkOption { + type = types.nullOr (types.attrsOf types.bool); + default = null; + description = '' + Each key in this dictionary is the label of another job. If the value of the key is true, then + this job is kept alive as long as that other job is enabled. Otherwise, if the value is false, + then this job is kept alive as long as the other job is disabled. This feature should not be + considered a substitute for the use of IPC. + ''; + }; + + }; + })); default = null; description = '' This optional key is used to control whether your job is to be kept continuously running or to let