about summary refs log tree commit diff
path: root/nixos/tests/starship.nix
blob: f21da1e6e255c848eff727e86fd43fbb226b783d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import ./make-test-python.nix ({ pkgs, ... }: {
  name = "starship";
  meta.maintainers = pkgs.starship.meta.maintainers;

  machine = {
    programs = {
      fish.enable = true;
      zsh.enable = true;

      starship = {
        enable = true;
        settings.format = "<starship>";
      };
    };

    services.getty.autologinUser = "root";
  };

  testScript = ''
    start_all()
    machine.wait_for_unit("default.target")

    for shell in ["bash", "fish", "zsh"]:
      machine.send_chars(f"script -c {shell} /tmp/{shell}.txt\n")
      machine.wait_until_tty_matches(1, f"Script started.*{shell}.txt")
      machine.send_chars("exit\n")
      machine.wait_until_tty_matches(1, "Script done")
      machine.sleep(1)
      machine.succeed(f"grep -q '<starship>' /tmp/{shell}.txt")
  '';
})