From d510f52ababfa2ad2e91c1c65b8ba5595411d1ad Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Thu, 16 May 2024 00:07:32 +0200 Subject: [PATCH] feat: add starship module --- hosts/luci/home-config.nix | 1 + modules/home-manager/cli/starship/default.nix | 60 +++++++++++++++++++ modules/home-manager/cli/zsh/default.nix | 9 --- modules/home-manager/default.nix | 1 + 4 files changed, 62 insertions(+), 9 deletions(-) create mode 100644 modules/home-manager/cli/starship/default.nix diff --git a/hosts/luci/home-config.nix b/hosts/luci/home-config.nix index d09db33..2f90896 100644 --- a/hosts/luci/home-config.nix +++ b/hosts/luci/home-config.nix @@ -10,6 +10,7 @@ ghq.enable = true; git.enable = true; neovim.enable = true; + starship.enable = true; utils.enable = true; vifm.enable = true; zsh.enable = true; diff --git a/modules/home-manager/cli/starship/default.nix b/modules/home-manager/cli/starship/default.nix new file mode 100644 index 0000000..afb8298 --- /dev/null +++ b/modules/home-manager/cli/starship/default.nix @@ -0,0 +1,60 @@ +{ lib, config, ... }: +with lib; +let + cfg = config.modules.cli.starship; +in +{ + options.modules.cli.starship = { + enable = mkEnableOption "enable starship prompt"; + }; + config = mkIf cfg.enable { + programs.starship = { + enable = true; + enableZshIntegration = true; + settings = { + format = "$username$hostname$directory$git_branch$git_state$git_status$cmd_duration$line_break $python$nix_shell$character"; + directory = { + style = "blue"; + truncate_to_repo = false; + }; + character = { + success_symbol = "[󰅂](purple)"; + error_symbol = "[󰅂](red)"; + vimcmd_symbol = "[󰅁](green)"; + }; + git_branch = { + format = "[$branch]($style)"; + style = "bright-black"; + }; + git_status = { + format = "[[( *$conflicted$untracked$modified$staged$renamed$deleted)](218) ($ahead_behind$stashed)]($style) "; + style = "cyan"; + conflicted = "​"; + untracked = "​"; + modified = "​"; + staged = "​"; + renamed = "​"; + deleted = "​"; + stashed = "≡"; + }; + git_state = { + format = "\\([$state( $progress_current/$progress_total)]($style)\\)"; + style = "bright-black"; + }; + cmd_duration = { + format = "[$duration]($style) "; + style = "yellow"; + }; + python = { + format = "[$virtualenv]($style) "; + style = "bright-black"; + }; + nix_shell = { + format = "[$symbol$name]($style) "; + symbol = " "; + style = "bright-black"; + }; + }; + }; + }; +} diff --git a/modules/home-manager/cli/zsh/default.nix b/modules/home-manager/cli/zsh/default.nix index 413f26d..bf4ceeb 100644 --- a/modules/home-manager/cli/zsh/default.nix +++ b/modules/home-manager/cli/zsh/default.nix @@ -89,15 +89,6 @@ in compinit -C ''; plugins = [ - { - name = "pure"; - src = pkgs.fetchFromGitHub { - owner = "sindresorhus"; - repo = "pure"; - rev = "v1.22.0"; - hash = "sha256-TR4CyBZ+KoZRs9XDmWE5lJuUXXU1J8E2Z63nt+FS+5w="; - }; - } { name = "base16-shell"; src = pkgs.fetchFromGitHub { diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index 435bc9a..9025c48 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -9,6 +9,7 @@ ./cli/ghq/default.nix ./cli/git ./cli/neovim + ./cli/starship ./cli/utils ./cli/vifm ./cli/zsh