summaryrefslogtreecommitdiff
path: root/modules/launchd
diff options
context:
space:
mode:
authorDaiderd Jordan <daiderd@gmail.com>2017-01-25 22:35:06 +0100
committerDaiderd Jordan <daiderd@gmail.com>2017-01-25 22:35:06 +0100
commit0cbdc2f8f961f14abda0b23e29d3f5ee2f62ad98 (patch)
tree162b7acf818c5bcde11cd2104b8675b573e210e0 /modules/launchd
parent199808713e10a71d4c04a3d6943793f39c29b212 (diff)
launchd: add user agents
Diffstat (limited to 'modules/launchd')
-rw-r--r--modules/launchd/default.nix20
1 files changed, 19 insertions, 1 deletions
diff --git a/modules/launchd/default.nix b/modules/launchd/default.nix
index faf60c2..d7c5054 100644
--- a/modules/launchd/default.nix
+++ b/modules/launchd/default.nix
@@ -35,7 +35,7 @@ let
path = mkOption {
type = types.listOf types.path;
default = [];
- apply = ps: "${makeBinPath ps}";
+ apply = ps: makeBinPath ps;
description = ''
Packages added to the service's <envar>PATH</envar>
environment variable. Both the <filename>bin</filename>
@@ -117,6 +117,22 @@ in
'';
};
+ launchd.user.agents = mkOption {
+ default = {};
+ type = types.attrsOf (types.submodule serviceOptions);
+ description = ''
+ Definition of per-user launchd agents.
+
+ When a user logs in, a per-user launchd is started.
+ It does the following:
+ 1. It loads the parameters for each launch-on-demand user agent from the property list files found in /System/Library/LaunchAgents, /Library/LaunchAgents, and the user’s individual Library/LaunchAgents directory.
+ 2. It registers the sockets and file descriptors requested by those user agents.
+ 3. It launches any user agents that requested to be running all the time.
+ 4. As requests for a particular service arrive, it launches the corresponding user agent and passes the request to it.
+ 5. When the user logs out, it sends a SIGTERM signal to all of the user agents that it started.
+ '';
+ };
+
};
config = {
@@ -124,5 +140,7 @@ in
environment.launchAgents = mapAttrs' toEnvironmentText cfg.agents;
environment.launchDaemons = mapAttrs' toEnvironmentText cfg.daemons;
+ environment.userLaunchAgents = mapAttrs' toEnvironmentText cfg.user.agents;
+
};
}