From d5165d670e7c30b0ad26691b7a53079796349ea7 Mon Sep 17 00:00:00 2001 From: foosinn Date: Sat, 13 Jun 2020 23:19:34 +0200 Subject: [PATCH] use starship --- dotfiles/starship.toml | 7 +++++++ roles/base.nix | 25 +++++++++++++------------ 2 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 dotfiles/starship.toml diff --git a/dotfiles/starship.toml b/dotfiles/starship.toml new file mode 100644 index 0000000..192cb4b --- /dev/null +++ b/dotfiles/starship.toml @@ -0,0 +1,7 @@ +add_newline = false + +[username] +show_always = true + +[hostname] +ssh_only = false diff --git a/roles/base.nix b/roles/base.nix index 4bd2dce..b6af0a3 100644 --- a/roles/base.nix +++ b/roles/base.nix @@ -1,9 +1,8 @@ -# Do not modify this file! It was generated by ‘nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. { config, lib, pkgs, ... }: -{ +let + unstable = import {}; +in { environment.systemPackages = with pkgs; [ bash bat @@ -15,13 +14,23 @@ jq ripgrep z-lua + unstable.starship (import ../packages/neovim.nix) ]; + environment = { + etc = { + "starship.toml".source = ../dotfiles/starship.toml; + }; + }; programs.bash = { + promptInit = '' + . <(starship init bash) + ''; interactiveShellInit = '' export EDITOR=nvim + export STARSHIP_CONFIG=/etc/starship.toml if [ -z "$SSH_AUTH_SOCK" ]; then eval $(ssh-agent) @@ -43,14 +52,6 @@ fi } - git_branch(){ - branch=$(git branch 2> /dev/null) || exit 0 - branch=$(sed -n '/^*/ s/* \(.*\)/\1/p' <<< $branch) - status=$(git status 2> /dev/null \ - | grep -q "nothing to commit, working tree clean" || e cho -n '*') - echo "$branch$status " - } - . "$(fzf-share)/key-bindings.bash" . "$(fzf-share)/completion.bash" . <(z --init bash)