nix/home-manager/shared/programs/shell/default.nix
2025-09-11 23:50:17 -05:00

105 lines
2.8 KiB
Nix
Executable file

{ pkgs, ... }:
{
imports = [
./tmux.nix
./git.nix
./fish
];
home = {
packages = with pkgs; [
eza
bat
ripgrep
fd
jq
nvim-pkg
];
};
programs.bash = {
enable = true;
enableCompletion = true;
historyControl = [ "ignorespace" ];
historyIgnore = [
":q"
"exit"
];
shellAliases = {
la = "eza -lahr";
ll = "la";
":q" = "exit";
};
shellOptions = [
"cmdhist"
"globstar"
"dirspell"
"dotglob"
"extglob"
"cdspell"
"histappend"
];
bashrcExtra = ''
export PROMPT_COMMAND="prompt_command;history -a"
export PATH="/usr/local/go/bin:~/go/bin:~/.bin:~/.local/bin:$PATH"
export EDITOR="nvim"
[[ $- != *i* ]] && return
function prompt_command {
GIT_BRANCH=$(git symbolic-ref --short HEAD 2>/dev/null | cut -c 1-10)
[[ $GIT_BRANCH != "" ]] && \
PS1="\[\033[38;5;1m\][\u@\h\[$(tput sgr0)\] \[$(tput sgr0)\]\[\033[38;5;7m\]\W\[$(tput sgr0)\]\[\033[38;5;1m\]]\[$(tput sgr0)\]\[$(tput sgr0)\]\[\033[38;5;3m\]($GIT_BRANCH)\[\033[38;5;7m\]\$\[$(tput sgr0)\] " || \
PS1="\[\033[38;5;1m\][\u@\h\[$(tput sgr0)\] \[$(tput sgr0)\]\[\033[38;5;7m\]\W\[$(tput sgr0)\]\[\033[38;5;1m\]]\[$(tput sgr0)\]\[$(tput sgr0)\]\[\033[38;5;3m\]\[\033[38;5;7m\]\$\[$(tput sgr0)\] "
}
bind "set completion-ignore-case on"
bind "set completion-map-case on"
bind "set show-all-if-ambiguous on"
bind "set menu-complete-display-prefix on"
bind '"\t":menu-complete'
bind '"\C-k": previous-history'
bind '"\C-j": next-history'
function cd {
cmd="eza"
builtin cd "$@" && $cmd
}
'';
initExtra = ''
if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]]
then
shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION=""
exec ${pkgs.fish}/bin/fish $LOGIN_OPTION
fi
'';
};
programs.fzf = {
enable = true;
historyWidgetOptions = [ "--height 60% --preview ''" ];
fileWidgetCommand = "command find -L . -mindepth 1 -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' -prune";
};
programs.direnv = {
enable = true;
silent = true;
enableBashIntegration = true;
nix-direnv.enable = true;
};
programs.gpg = {
enable = true;
settings = {
pinentry-mode = "loopback";
};
};
programs.zoxide = {
enable = true;
enableFishIntegration = true;
};
services.gpg-agent = {
enable = true;
enableSshSupport = true;
pinentry.package = pkgs.pinentry-rofi;
extraConfig = ''
allow-loopback-pinentry
'';
};
programs.nix-index = {
enableBashIntegration = false;
enableFishIntegration = true;
};
}