1import ./make-test-python.nix ({ pkgs, ...} : {
2 name = "zsh-history";
3 meta = with pkgs.lib.maintainers; {
4 maintainers = [ ];
5 };
6
7 nodes.default = { ... }: {
8 programs = {
9 zsh.enable = true;
10 };
11 environment.systemPackages = [ pkgs.zsh-history ];
12 programs.zsh.interactiveShellInit = ''
13 source ${pkgs.zsh-history.out}/share/zsh/init.zsh
14 '';
15 users.users.root.shell = "${pkgs.zsh}/bin/zsh";
16 };
17
18 testScript = ''
19 start_all()
20 default.wait_for_unit("multi-user.target")
21 default.wait_until_succeeds("pgrep -f 'agetty.*tty1'")
22
23 # Login
24 default.wait_until_tty_matches("1", "login: ")
25 default.send_chars("root\n")
26 default.wait_until_tty_matches("1", r"\nroot@default\b")
27
28 # Generate some history
29 default.send_chars("echo foobar\n")
30 default.wait_until_tty_matches("1", "foobar")
31
32 # Ensure that command was recorded in history
33 default.succeed("/run/current-system/sw/bin/history list | grep -q foobar")
34 '';
35})