diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-05-17 13:41:08 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-05-17 13:41:08 +0200 |
commit | a058b4e0f6d9a969450fc2e8ef24c6f594e47020 (patch) | |
tree | ccf7f90de7d48c398fdc6e78dc86f75645a71cee /modules/home.legacy/conf/starship/default.nix | |
parent | modules/nixos-shell: Init (diff) | |
download | nixos-config-a058b4e0f6d9a969450fc2e8ef24c6f594e47020.zip |
modules/starship: Mark shells that are started in a nixos-shell VM
Diffstat (limited to '')
-rw-r--r-- | modules/home.legacy/conf/starship/default.nix | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/modules/home.legacy/conf/starship/default.nix b/modules/home.legacy/conf/starship/default.nix index 8d408141..6a6938f7 100644 --- a/modules/home.legacy/conf/starship/default.nix +++ b/modules/home.legacy/conf/starship/default.nix @@ -10,20 +10,24 @@ { lib, nixosConfig, + pkgs, ... }: { programs.starship = { enable = true; enableZshIntegration = true; + settings = { add_newline = false; format = lib.concatStrings [ "$directory" "$username" + "\${custom.in_nixos_shell}" "$cmd_duration" "$status" "$character" ]; + right_format = lib.concatStrings ( [ "$git_metrics" @@ -37,24 +41,30 @@ nixosConfig.soispha.laptop.enable "$battery" ); + scan_timeout = 20; + character = { # success_symbol = "[❯](bold blue)"; # a = "⬢"; success_symbol = "[](bold blue)"; error_symbol = "[](bold red)"; }; + status = { disabled = false; format = "([($common_meaning )($status)( $signal_name)]($style) )"; }; + time = { disabled = false; format = "[\\[$time\\]]($style)"; }; + username = { format = "as [$user]($style) "; }; + git_branch = { format = "[($symbol$branch(:$remote_branch) )]($style)"; }; @@ -85,22 +95,28 @@ tag_symbol = "v"; format = "[(\\[$tag\\] )]($style)"; }; + directory = { truncate_to_repo = true; read_only = " "; before_repo_root_style = "black bold dimmed"; }; + cmd_duration = { min_time = 2000; # Milliseconds style = "bold white"; }; + custom = { - # status_output = { - # format = "$output"; - # command = "if test $STARSHIP_CMD_STATUS -ne 0; then echo \"bold red\"; else echo \"bold cyan\"; fi"; - # shell = [ "${pkgs.dash}" ]; - # }; + in_nixos_shell = { + symbol = "VM "; + style = "bold white"; + when = ''test "$IN_NIXOS_SHELL" = true ''; + shell = ["${lib.getExe pkgs.dash}"]; + description = "Show if a shell is run in a vm"; + }; }; + battery = { # ' ' # ' ' |