diff options
-rw-r--r-- | nixos/tests/all-tests.nix | 1 | ||||
-rw-r--r-- | nixos/tests/starship.nix | 31 | ||||
-rw-r--r-- | pkgs/tools/misc/starship/default.nix | 5 |
3 files changed, 37 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 5ebe07ad3cb73..1282d62272e1e 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -445,6 +445,7 @@ in sslh = handleTest ./sslh.nix {}; sssd = handleTestOn ["x86_64-linux"] ./sssd.nix {}; sssd-ldap = handleTestOn ["x86_64-linux"] ./sssd-ldap.nix {}; + starship = handleTest ./starship.nix {}; step-ca = handleTestOn ["x86_64-linux"] ./step-ca.nix {}; strongswan-swanctl = handleTest ./strongswan-swanctl.nix {}; sudo = handleTest ./sudo.nix {}; 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") + ''; +}) diff --git a/pkgs/tools/misc/starship/default.nix b/pkgs/tools/misc/starship/default.nix index 25a6aaecd0224..165ed45d7b7aa 100644 --- a/pkgs/tools/misc/starship/default.nix +++ b/pkgs/tools/misc/starship/default.nix @@ -6,6 +6,7 @@ , openssl , installShellFiles , libiconv +, nixosTests , Security }: @@ -40,6 +41,10 @@ rustPlatform.buildRustPackage rec { HOME=$TMPDIR ''; + passthru.tests = { + inherit (nixosTests) starship; + }; + meta = with lib; { description = "A minimal, blazing fast, and extremely customizable prompt for any shell"; homepage = "https://starship.rs"; |