1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-14 11:57:34 +00:00
nix-darwin/tests/activation-scripts.nix
2018-01-14 16:08:27 +01:00

27 lines
1.2 KiB
Nix

{ 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
'';
}