2019-12-13 20:47:15 +00:00
|
|
|
import ./make-test-python.nix ({ pkgs, ...} : {
|
|
|
|
name = "zsh-history";
|
2021-01-10 19:08:30 +00:00
|
|
|
meta = with pkgs.lib.maintainers; {
|
2021-01-18 20:23:49 +00:00
|
|
|
maintainers = [ ];
|
2019-12-13 20:47:15 +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-04 04:22:03 +00:00
|
|
|
default.wait_until_tty_matches("1", "login: ")
|
2019-12-13 20:47:15 +00:00
|
|
|
default.send_chars("root\n")
|
2022-06-04 04:22:03 +00:00
|
|
|
default.wait_until_tty_matches("1", r"\nroot@default\b")
|
2019-12-13 20:47:15 +00:00
|
|
|
|
|
|
|
# Generate some history
|
|
|
|
default.send_chars("echo foobar\n")
|
2022-06-04 04:22:03 +00:00
|
|
|
default.wait_until_tty_matches("1", "foobar")
|
2019-12-13 20:47:15 +00:00
|
|
|
|
|
|
|
# Ensure that command was recorded in history
|
|
|
|
default.succeed("/run/current-system/sw/bin/history list | grep -q foobar")
|
|
|
|
'';
|
|
|
|
})
|