at main 2.4 kB view raw
1{ 2 config, 3 inputs', 4 lib, 5 ... 6}: 7{ 8 config = lib.mkIf config.dev.shell.enable { 9 xdg.configFile."starship-jj/starship-jj.toml".text = '' 10 "$schema"="https://gitlab.com/Lanastara/lanastara_foss/-/raw/v0.3.0/schema.json?ref_type=tags" 11 module_separator = " " 12 timeout = 1000 13 [bookmarks] 14 search_depth = 100 15 exclude = [] 16 17 [[module]] 18 type = "Commit" 19 empty_text = "" 20 [module.change] 21 fg = "magenta" 22 23 [[module]] 24 type = "Bookmarks" 25 separator = " " 26 color = "Magenta" 27 behind_symbol = "" 28 29 [[module]] 30 type = "State" 31 separator = " " 32 33 [module.conflict] 34 disabled = true 35 text = "(CONFLICT)" 36 color = "Red" 37 38 [module.divergent] 39 disabled = true 40 text = "(DIVERGENT)" 41 color = "Cyan" 42 43 [module.empty] 44 disabled = false 45 text = "(EMPTY)" 46 color = "Yellow" 47 48 [module.immutable] 49 disabled = false 50 text = "(IMMUTABLE)" 51 color = "Yellow" 52 53 [module.hidden] 54 disabled = false 55 text = "(HIDDEN)" 56 color = "Yellow" 57 58 [[module]] 59 type = "Metrics" 60 template = "[{changed} {added}{removed}]" 61 color = "Magenta" 62 63 [module.changed_files] 64 prefix = "" 65 suffix = "" 66 color = "Cyan" 67 68 [module.added_lines] 69 prefix = "+" 70 suffix = "" 71 color = "Green" 72 73 [module.removed_lines] 74 prefix = "-" 75 suffix = "" 76 color = "Red" 77 ''; 78 programs.starship = { 79 enable = true; 80 settings = { 81 format = lib.concatMapStrings (s: s) [ 82 "$directory" 83 "$nix_shell" 84 "$custom" 85 "$cmd_duration" 86 "$line_break" 87 "$character" 88 ]; 89 nix_shell = { 90 format = "[$symbol]($style)"; 91 }; 92 custom = { 93 jj = { 94 command = "${lib.getExe' inputs'.starship-jj.packages.default "starship-jj"} --ignore-working-copy starship prompt"; 95 format = "[$symbol](blue bold) $output"; 96 symbol = "󱗆"; 97 when = "jj root --ignore-working-copy"; 98 }; 99 git_branch = { 100 when = true; 101 command = "jj root >/dev/null 2>&1 || starship module git_branch"; 102 description = "Only show git_branch if we're not in a jj repo"; 103 }; 104 }; 105 }; 106 }; 107 }; 108}