about summary refs log tree commit diff stats
path: root/modules/home.legacy/conf/starship/default.nix
blob: 6a6938f78f6b5bbe101a5838f98766cd90160190 (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# nixos-config - My current NixOS configuration
#
# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
# SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of my nixos-config.
#
# You should have received a copy of the License along with this program.
# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{
  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"
          "$git_branch"
          "$git_status"
          "$git_commit"
          "$git_state"
          "$time"
        ]
        ++ lib.optional
        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)";
      };
      git_status = {
        disabled = true;
        format = "([\\[$ahead_behind\\]]($style) )";
        ahead = "⇡$count";
        diverged = "⇕⇡$ahead_count⇣$behind_count";
        behind = "⇣$count";
      };
      git_metrics = {
        disabled = true;
        ignore_submodules = true;
      };
      git_state = {
        format = "[\($state( $progress_current of $progress_total)\)]($style) ";
        rebase = "[rebasing](bold magenta)";
        merge = "[merging](bold yellow)";
        revert = "[reverting](bold blue)";
        cherry_pick = "[picking](bold red)";
        bisect = "[bisecting](bold red)";
        am = "[applying](bold green)";
        am_or_rebase = "[applying/rebasing](bold yellow)";
      };
      git_commit = {
        disabled = true;
        tag_disabled = false;
        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 = {
        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 = {
        # '󰁹 '
        #   '󰂄 '
        #   '󰂃 '
        #   '󰁽 '
        #   '󰂎 '
        display = [
          {
            threshold = 10;
            style = "bold red";
          }
          {
            threshold = 30;
            style = "bold blue";
          }
          {
            threshold = 50;
            style = "bold green";
          }
        ];
      };
    };
  };
}