2020-04-24 23:36:52 +00:00
|
|
|
import ./make-test-python.nix ({ pkgs, ...} : {
|
|
|
|
name = "zsh-history";
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with pkgs.lib.maintainers; {
|
2021-02-05 17:12:51 +00:00
|
|
|
maintainers = [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nodes.default = { ... }: {
|
|
|
|
programs = {
|
|
|
|
zsh.enable = true;
|
|
|
|
};
|
|
|
|
environment.systemPackages = [ pkgs.zsh-history ];
|
|
|
|
programs.zsh.interactiveShellInit = ''
|
|
|
|
source ${pkgs.zsh-history.out}/share/zsh/init.zsh
|
|
|
|
'';
|
|
|
|
users.users.root.shell = "${pkgs.zsh}/bin/zsh";
|
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
|
|
|
start_all()
|
|
|
|
default.wait_for_unit("multi-user.target")
|
|
|
|
default.wait_until_succeeds("pgrep -f 'agetty.*tty1'")
|
|
|
|
|
|
|
|
# Login
|
2022-06-16 17:23:12 +00:00
|
|
|
default.wait_until_tty_matches("1", "login: ")
|
2020-04-24 23:36:52 +00:00
|
|
|
default.send_chars("root\n")
|
2022-06-16 17:23:12 +00:00
|
|
|
default.wait_until_tty_matches("1", r"\nroot@default\b")
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# Generate some history
|
|
|
|
default.send_chars("echo foobar\n")
|
2022-06-16 17:23:12 +00:00
|
|
|
default.wait_until_tty_matches("1", "foobar")
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# Ensure that command was recorded in history
|
|
|
|
default.succeed("/run/current-system/sw/bin/history list | grep -q foobar")
|
|
|
|
'';
|
|
|
|
})
|