#
# Shell
#

{ pkgs, ... }:

{
  programs = {
    zsh = {
      enable = true;
      dotDir = ".config/zsh_nix";
      enableAutosuggestions = true;             # Auto suggest options and highlights syntact, searches in history for options
      enableSyntaxHighlighting = true;
      history.size = 10000;

      oh-my-zsh = {                             # Extra plugins for zsh
        enable = true;
        plugins = [ "git" ];
        custom = "$HOME/.config/zsh_nix/custom";
      };

      initExtraFirst = ''                            # very first inits in zshrc
        if [[ $DISPLAY ]]; then
            [[ $- != *i* ]] && return
            [[ -z "$TMUX" ]] && (tmux attach || tmux new-session)
        fi
      '';

      initExtra = ''                            # Zsh theme
        #export GPG_TTY=$(tty)
        #gpg-connect-agent updatestartuptty /bye >/dev/null
        #unset SSH_AGENT_PID
        #export SSH_AUTH_SOCK="/run/user/$UID/gnupg/S.gpg-agent.ssh"
        # Spaceship
        source ${pkgs.spaceship-prompt}/share/zsh/site-functions/prompt_spaceship_setup
        autoload -U promptinit; promptinit
#       source $HOME/.config/shell/shell_init
        # Hook direnv
#       emulate zsh -c "$(direnv hook zsh)"
        # Swag
        pfetch                                  # Show fetch logo on terminal start
      '';
    };
  };
}