about summary refs log tree commit diff
path: root/nixos/tests/starship.nix
diff options
context:
space:
mode:
authorDaniel Thwaites <danthwaites30@btinternet.com>2021-12-24 11:24:29 +0000
committerDaniel Thwaites <danthwaites30@btinternet.com>2022-01-12 15:47:15 +0000
commitf366ae6429096615914dd24a3ae59d7215b34180 (patch)
tree4b9e9360c45de6f47a44bad014d993910b8de66e /nixos/tests/starship.nix
parent3f1ef8fe14ed87c0999f2a5ce7a5a1b3c3b8d7ec (diff)
nixos/starship: add a test
Diffstat (limited to 'nixos/tests/starship.nix')
-rw-r--r--nixos/tests/starship.nix31
1 files changed, 31 insertions, 0 deletions
diff --git a/nixos/tests/starship.nix b/nixos/tests/starship.nix
new file mode 100644
index 0000000000000..f21da1e6e255c
--- /dev/null
+++ b/nixos/tests/starship.nix
@@ -0,0 +1,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")
+  '';
+})