From 0cbdc2f8f961f14abda0b23e29d3f5ee2f62ad98 Mon Sep 17 00:00:00 2001 From: Daiderd Jordan Date: Wed, 25 Jan 2017 22:35:06 +0100 Subject: launchd: add user agents --- modules/launchd/default.nix | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'modules/launchd') 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 PATH environment variable. Both the bin @@ -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; + }; } -- cgit v1.2.3