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