1 import ./make-test-python.nix ({ lib, ... }: {
2 name = "user-activation-scripts";
3 meta = with lib.maintainers; { maintainers = [ chkno ]; };
6 system.userActivationScripts.foo = "mktemp ~/user-activation-ran.XXXXXX";
8 initialPassword = "pass1";
14 def verify_user_activation_run_count(n):
16 '[[ "$(find /home/alice/ -name user-activation-ran.\\* | wc -l)" == %s ]]' % n
20 machine.wait_for_unit("multi-user.target")
21 machine.wait_for_unit("getty@tty1.service")
22 machine.wait_until_tty_matches("1", "login: ")
23 machine.send_chars("alice\n")
24 machine.wait_until_tty_matches("1", "Password: ")
25 machine.send_chars("pass1\n")
26 machine.send_chars("touch login-ok\n")
27 machine.wait_for_file("/home/alice/login-ok")
28 verify_user_activation_run_count(1)
30 machine.succeed("/run/current-system/bin/switch-to-configuration test")
31 verify_user_activation_run_count(2)