launchd: add agent domain option
Allow Darwin LaunchAgents to target either the GUI or user launchd domain while preserving gui as the compatibility default.
This commit is contained in:
parent
062581938b
commit
dc89b0c0bb
6 changed files with 159 additions and 12 deletions
20
tests/modules/launchd/agent-domain.nix
Normal file
20
tests/modules/launchd/agent-domain.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
config = {
|
||||
launchd.agents."user-service" = {
|
||||
enable = true;
|
||||
domain = "user";
|
||||
config.ProgramArguments = [
|
||||
"/some/command"
|
||||
];
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
serviceFile=LaunchAgents/org.nix-community.home.user-service.plist
|
||||
assertFileExists $serviceFile
|
||||
|
||||
domainFile=LaunchAgentDomains/org.nix-community.home.user-service.domain
|
||||
assertFileExists $domainFile
|
||||
assertFileContent $domainFile ${builtins.toFile "expected-domain" "user\n"}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
@ -22,6 +22,16 @@
|
|||
serviceFile=LaunchAgents/org.nix-community.home.test-service.plist
|
||||
assertFileExists $serviceFile
|
||||
assertFileContent $serviceFile ${./expected-agent.plist}
|
||||
|
||||
domainFile=LaunchAgentDomains/org.nix-community.home.test-service.domain
|
||||
assertFileExists $domainFile
|
||||
assertFileContent $domainFile ${builtins.toFile "expected-domain" "gui\n"}
|
||||
|
||||
assertFileExists activate
|
||||
assertFileContains activate 'readAgentDomain'
|
||||
assertFileContains activate 'resolveDomain'
|
||||
assertFileContains activate "printf 'gui/%s"
|
||||
assertFileContains activate "printf 'user/%s"
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1,4 @@
|
|||
{ launchd-agents = ./agents.nix; }
|
||||
{
|
||||
launchd-agent-domain = ./agent-domain.nix;
|
||||
launchd-agents = ./agents.nix;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue