Home

dotnix @059cc98835537a233c5cc58f3b9e84ebfb768a6d - refs - log -
-
https://git.jolheiser.com/dotnix.git
My nix dotfiles
dotnix / home / nogui / oh-my-posh.nix
- raw -
  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
{ pkgs, ... }:
let
  unicode = x: builtins.fromJSON ''"${x}"'';
  gitBugScript = pkgs.writeShellApplication {
    name = "git-bug-prompt";
    runtimeInputs = [
      pkgs.git-bug
      pkgs.jq
    ];
    text = ''
      git-bug bug --format json status:open | jq 'length'
    '';
  };
in
{
  programs.oh-my-posh = {
    enable = true;
    settings = {
      "$schema" = "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json";
      blocks = [
        {
          alignment = "left";
          segments = [
            {
              background = "p:lavender";
              foreground = "p:black";
              leading_diamond = unicode "\\ue0b6";
              properties = {
                display_host = false;
              };
              style = "diamond";
              template = " {{ if .SSHSession }}${unicode "\\udb80\\udf18"} {{ end }}{{ if .Env.IN_NIX_SHELL }}${unicode "\\udb84\\udd05"} {{ end }}{{ .UserName }}@{{ .HostName }} ";
              trailing_diamond = unicode "\\ue0b0";
              type = "session";
            }
            {
              background = "p:orange";
              foreground = "p:black";
              powerline_symbol = unicode "\\ue0b0";
              properties = {
                home_icon = "~";
                style = "folder";
              };
              style = "powerline";
              template = " ${unicode "\\ue613"} {{ path .Path .Location }} ";
              type = "path";
            }
            {
              background = "p:green";
              background_templates = [
                "{{ if or (.Working.Changed) (.Staging.Changed) }}p:yellow{{ end }}"
                "{{ if and (gt .Ahead 0) (gt .Behind 0) }}p:red{{ end }}"
                "{{ if gt .Ahead 0 }}#49416D{{ end }}"
                "{{ if gt .Behind 0 }}#7A306C{{ end }}"
              ];
              foreground = "p:black";
              foreground_templates = [
                "{{ if or (.Working.Changed) (.Staging.Changed) }}p:black{{ end }}"
                "{{ if and (gt .Ahead 0) (gt .Behind 0) }}p:white{{ end }}"
                "{{ if gt .Ahead 0 }}p:white{{ end }}"
              ];
              powerline_symbol = unicode "\\ue0b0";
              properties = {
                branch_max_length = 25;
                fetch_status = true;
                fetch_upstream_icon = true;
                git_icon = unicode "\\ue702";
                github_icon = unicode "\\uf408";
                upstream_icons = {
                  "codeberg.org" = unicode "\\ue2a6";
                  "git.jojodev.com" = unicode "\\udb83\\udd9e";
                  "gitea.com" = unicode "\\udb83\\udd9e";
                };
                disable_with_jj = true;
              };
              style = "powerline";
              type = "git";
            }
            {
              type = "jujutsu";
              style = "powerline";
              powerline_symbol = "";
              foreground = "p:black";
              background = "p:green";
              options = {
                fetch_status = true;
                ignore_working_copy = false;
                fetch_ahead_counter = true;
                ahead_icon = "⇡";
              };
            }
            {
              background = "p:maroon";
              foreground = "p:black";
              powerline_symbol = unicode "\\ue0b0";
              properties = {
                script = "${gitBugScript}/bin/git-bug-prompt";
              };
              style = "powerline";
              template = "{{ if (glob \".git/refs/bugs\")}} 󰃤 {{ .Output }} {{ end }}";
              type = "command";
            }
            {
              background = "p:blue";
              background_templates = [ "{{ if gt .Code 0 }}p:red{{ end }}" ];
              foreground = "p:black";
              leading_diamond = "<transparent,background>${unicode "\\ue0b0"}</>";
              properties = {
                always_enabled = true;
              };
              style = "diamond";
              template = " {{ if gt .Code 0 }}${unicode "\\uf00d"}{{ else }}${unicode "\\uf00c"}{{ end }} ";
              trailing_diamond = unicode "\\ue0b4";
              type = "exit";
            }
          ];
          type = "prompt";
        }
      ];
      console_title_template = "{{ .Folder }}";
      final_space = true;
      palette = {
        black = "#1E1E1E";
        blue = "#89B4FA";
        green = "#A6E3A1";
        lavender = "#B4BEFE";
        orange = "#FAB387";
        red = "#F38BA8";
        maroon = "#EBA0AC";
        white = "#CDD6F4";
        yellow = "#F9E2AF";
      };
      version = 2;
    };
  };
}