1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-14 11:57:34 +00:00

launchd: add basic test for daemons/agents

This commit is contained in:
Daiderd Jordan 2019-03-22 20:49:53 +01:00
parent b68f77b404
commit af7cd05699
No known key found for this signature in database
GPG key ID: D02435D05B810C96
2 changed files with 18 additions and 0 deletions

View file

@ -92,6 +92,7 @@ let
tests.activation-scripts = makeTest ./tests/activation-scripts.nix; tests.activation-scripts = makeTest ./tests/activation-scripts.nix;
tests.checks-nix-gc = makeTest ./tests/checks-nix-gc.nix; tests.checks-nix-gc = makeTest ./tests/checks-nix-gc.nix;
tests.environment-path = makeTest ./tests/environment-path.nix; tests.environment-path = makeTest ./tests/environment-path.nix;
tests.launchd-daemons = makeTest ./tests/launchd-daemons.nix;
tests.launchd-setenv = makeTest ./tests/launchd-setenv.nix; tests.launchd-setenv = makeTest ./tests/launchd-setenv.nix;
tests.networking-hostname = makeTest ./tests/networking-hostname.nix; tests.networking-hostname = makeTest ./tests/networking-hostname.nix;
tests.networking-networkservices = makeTest ./tests/networking-networkservices.nix; tests.networking-networkservices = makeTest ./tests/networking-networkservices.nix;

17
tests/launchd-daemons.nix Normal file
View file

@ -0,0 +1,17 @@
{ config, pkgs, ... }:
{
launchd.daemons.foo.command = "foo";
launchd.agents.bar.command = "bar";
launchd.user.agents.baz.command = "baz";
test = ''
echo "checking launchd load in /activate" >&2
grep "launchctl load .* '/Library/LaunchDaemons/org.nixos.foo.plist" ${config.out}/activate
grep "launchctl load .* '/Library/LaunchAgents/org.nixos.bar.plist" ${config.out}/activate
echo "checking launchd load in /activate-user" >&2
grep "launchctl load .* ~/Library/LaunchAgents/org.nixos.baz.plist" ${config.out}/activate-user
echo "checking LaunchAgents creation /activate-user" >&2
grep "mkdir -p ~/Library/LaunchAgents" ${config.out}/activate-user
'';
}