mirror of
https://github.com/LnL7/nix-darwin.git
synced 2024-12-14 11:57:34 +00:00
activation-scripts: add test for pre/post hooks
This commit is contained in:
parent
e9cbcbb549
commit
46d6951fd2
2 changed files with 28 additions and 0 deletions
|
@ -89,6 +89,7 @@ let
|
||||||
examples.lnl = genExample ./modules/examples/lnl.nix;
|
examples.lnl = genExample ./modules/examples/lnl.nix;
|
||||||
examples.simple = genExample ./modules/examples/simple.nix;
|
examples.simple = genExample ./modules/examples/simple.nix;
|
||||||
|
|
||||||
|
tests.activation-scripts = makeTest ./tests/activation-scripts.nix;
|
||||||
tests.environment-path = makeTest ./tests/environment-path.nix;
|
tests.environment-path = makeTest ./tests/environment-path.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;
|
||||||
|
|
27
tests/activation-scripts.nix
Normal file
27
tests/activation-scripts.nix
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
system.activationScripts.preUserActivation.text = "echo hook preUserActivation";
|
||||||
|
system.activationScripts.extraUserActivation.text = "echo hook extraUserActivation";
|
||||||
|
system.activationScripts.postUserActivation.text = "echo hook postUserActivation";
|
||||||
|
|
||||||
|
system.activationScripts.preActivation.text = "echo hook preActivation";
|
||||||
|
system.activationScripts.extraActivation.text = "echo hook extraActivation";
|
||||||
|
system.activationScripts.postActivation.text = "echo hook postActivation";
|
||||||
|
|
||||||
|
test = ''
|
||||||
|
countHooks() {
|
||||||
|
awk '/echo hook / {i++ ; print i " => " $0}' "$2" | grep "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
echo checking activation hooks in /activate-user >&2
|
||||||
|
countHooks "1 => echo hook preUserActivation" ${config.out}/activate-user
|
||||||
|
countHooks "2 => echo hook extraUserActivation" ${config.out}/activate-user
|
||||||
|
countHooks "3 => echo hook postUserActivation" ${config.out}/activate-user
|
||||||
|
|
||||||
|
echo checking activation hooks in /activate >&2
|
||||||
|
countHooks "1 => echo hook preActivation" ${config.out}/activate
|
||||||
|
countHooks "2 => echo hook extraActivation" ${config.out}/activate
|
||||||
|
countHooks "3 => echo hook postActivation" ${config.out}/activate
|
||||||
|
'';
|
||||||
|
}
|
Loading…
Reference in a new issue