about summary refs log tree commit diff
path: root/nixos/tests/starship.nix
blob: 48a4be6caf1760b3f6eefda74a398b7a2882d0c5 (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
32
33
34
35
36
37
38
39
40
41
42
import ./make-test-python.nix ({ pkgs, ... }: {
  name = "starship";
  meta.maintainers = pkgs.starship.meta.maintainers;

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

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

    environment.systemPackages = map
      (shell: pkgs.writeScriptBin "expect-${shell}" ''
        #!${pkgs.expect}/bin/expect -f

        spawn env TERM=xterm ${shell} -i

        expect "<starship>" {
          send "exit\n"
        } timeout {
          send_user "\n${shell} failed to display Starship\n"
          exit 1
        }

        expect eof
      '')
      [ "bash" "fish" "zsh" ];
  };

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

    machine.succeed("expect-bash")
    machine.succeed("expect-fish")
    machine.succeed("expect-zsh")
  '';
})