nixpkgs/nixos/tests/zsh-history.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

41 lines
1.1 KiB
Nix
Raw Normal View History

2019-12-13 20:47:15 +00:00
import ./make-test-python.nix (
{ pkgs, ... }:
{
name = "zsh-history";
meta = with pkgs.lib.maintainers; {
maintainers = [ ];
2019-12-13 20:47:15 +00:00
};
nodes.default =
{ ... }:
{
2019-12-13 20:47:15 +00:00
programs = {
zsh.enable = true;
};
2019-12-13 20:47:15 +00:00
environment.systemPackages = [ pkgs.zsh-history ];
programs.zsh.interactiveShellInit = ''
source ${pkgs.zsh-history.out}/share/zsh/init.zsh
'';
2019-12-13 20:47:15 +00:00
users.users.root.shell = "${pkgs.zsh}/bin/zsh";
};
2019-12-13 20:47:15 +00:00
testScript = ''
2019-12-13 20:47:15 +00:00
start_all()
default.wait_for_unit("multi-user.target")
default.wait_until_succeeds("pgrep -f 'agetty.*tty1'")
2019-12-13 20:47:15 +00:00
# Login
default.wait_until_tty_matches("1", "login: ")
default.send_chars("root\n")
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")
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")
'';
}
)