From af7cd05699fea0d782e9f23a98d73bd2e696061b Mon Sep 17 00:00:00 2001 From: Daiderd Jordan Date: Fri, 22 Mar 2019 20:49:53 +0100 Subject: [PATCH] launchd: add basic test for daemons/agents --- release.nix | 1 + tests/launchd-daemons.nix | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 tests/launchd-daemons.nix diff --git a/release.nix b/release.nix index 8445f2fc..ae282cd4 100644 --- a/release.nix +++ b/release.nix @@ -92,6 +92,7 @@ let tests.activation-scripts = makeTest ./tests/activation-scripts.nix; tests.checks-nix-gc = makeTest ./tests/checks-nix-gc.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.networking-hostname = makeTest ./tests/networking-hostname.nix; tests.networking-networkservices = makeTest ./tests/networking-networkservices.nix; diff --git a/tests/launchd-daemons.nix b/tests/launchd-daemons.nix new file mode 100644 index 00000000..59e35aa6 --- /dev/null +++ b/tests/launchd-daemons.nix @@ -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 + ''; +}