diff options
| author | Arpit Chakladar <arpitchakladar@gmail.com> | 2026-09-24 03:42:25 +0530 |
|---|---|---|
| committer | Arpit Chakladar <arpitchakladar@gmail.com> | 2026-09-24 03:42:25 +0530 |
| commit | 30f8fea050f3242f0e6a2072779e706b5c8ceaf1 (patch) | |
| tree | a02b517bd112d4e91fab15166a4866bff252c2d3 /modules/terminal/starship | |
| parent | ad96214c9ab94bce925000a6059e3c68e2ff6a22 (diff) | |
| download | home-manager-config-30f8fea050f3242f0e6a2072779e706b5c8ceaf1.tar.gz home-manager-config-30f8fea050f3242f0e6a2072779e706b5c8ceaf1.zip | |
refactor(modules): introduce cfg local bindings and submodule option types
Diffstat (limited to 'modules/terminal/starship')
| -rw-r--r-- | modules/terminal/starship/default.nix | 96 |
1 files changed, 51 insertions, 45 deletions
diff --git a/modules/terminal/starship/default.nix b/modules/terminal/starship/default.nix index 6aa83d6..3a7d8af 100644 --- a/modules/terminal/starship/default.nix +++ b/modules/terminal/starship/default.nix @@ -1,5 +1,15 @@ # Minimal, blazing-fast shell prompt -{ config, lib, ... }: +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.terminal.starship; + + mkSegment = content: ''[┄\[](red)[${content}]($style)[\]](red)''; +in { options.terminal.starship = { enable = lib.mkEnableOption "Enables starship."; @@ -11,63 +21,59 @@ }; }; - config = lib.mkIf config.terminal.starship.enable { + config = lib.mkIf cfg.enable { programs.starship = { enable = true; enableZshIntegration = config.terminal.zsh.enable; - settings = - let - mkSegment = content: ''[┄\[](red)[${content}]($style)[\]](red)''; - in - { - add_newline = true; + settings = { + add_newline = true; - format = ''''\n[╭─\[](red)$username[@](red)$hostname[\]](red)$directory$git_branch$git_status$nix_shell''\n[╰─](red)$status$character ''\n''; + format = ''''\n[╭─\[](red)$username[@](red)$hostname[\]](red)$directory$git_branch$git_status$nix_shell''\n[╰─](red)$status$character ''\n''; - character.format = "[](red)"; + character.format = "[](red)"; - username = { - style_user = "blue"; - style_root = "red bold"; - format = "[$user]($style)"; - show_always = true; - }; + username = { + style_user = "blue"; + style_root = "red bold"; + format = "[$user]($style)"; + show_always = true; + }; - hostname = { - ssh_only = false; - style = "green"; - format = "[$hostname]($style)"; - }; + hostname = { + ssh_only = false; + style = "green"; + format = "[$hostname]($style)"; + }; - directory = { - style = "purple"; - truncate_to_repo = false; - format = mkSegment "$path"; - }; + directory = { + style = "purple"; + truncate_to_repo = false; + format = mkSegment "$path"; + }; - git_branch = { - style = "bold yellow"; - format = ''[┄\[](red)[$symbol$branch(:$remote_branch)]($style)''; - }; + git_branch = { + style = "bold yellow"; + format = ''[┄\[](red)[$symbol$branch(:$remote_branch)]($style)''; + }; - git_status = { - style = "cyan"; - format = ''( [$all_status$ahead_behind]($style))[\]](red)''; - }; + git_status = { + style = "cyan"; + format = ''( [$all_status$ahead_behind]($style))[\]](red)''; + }; - nix_shell = { - format = mkSegment "$symbol $state( \($name\))"; - symbol = ""; - impure_msg = ""; - pure_msg = ""; - }; + nix_shell = { + format = mkSegment "$symbol $state( \($name\))"; + symbol = ""; + impure_msg = ""; + pure_msg = ""; + }; - status = { - disabled = false; - format = "${mkSegment "$symbol $status"}[┄─](red)"; - style = "white"; - }; + status = { + disabled = false; + format = "${mkSegment "$symbol $status"}[┄─](red)"; + style = "white"; }; + }; }; }; } |
