init
This commit is contained in:
227
modules/home/shell.nix
Normal file
227
modules/home/shell.nix
Normal file
@@ -0,0 +1,227 @@
|
||||
# Shell configuration module
|
||||
#
|
||||
# This module configures the shell environment including:
|
||||
# - Zsh with Home Manager's programs.zsh
|
||||
# - Starship prompt
|
||||
# - Atuin for shell history
|
||||
# - Direnv for directory-specific environments
|
||||
# - Zoxide for smart directory navigation
|
||||
# - Shell aliases from the chezmoi configuration
|
||||
# - Environment variables
|
||||
# - NVM for Node.js version management
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
# ==========================================================================
|
||||
# Zsh Configuration
|
||||
# ==========================================================================
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
|
||||
# Enable zsh completions
|
||||
enableCompletion = true;
|
||||
|
||||
# Enable syntax highlighting
|
||||
syntaxHighlighting.enable = true;
|
||||
|
||||
# Enable autosuggestions
|
||||
autosuggestion.enable = true;
|
||||
|
||||
# History settings
|
||||
history = {
|
||||
size = 50000;
|
||||
save = 50000;
|
||||
ignoreDups = true;
|
||||
ignoreAllDups = true;
|
||||
ignoreSpace = true;
|
||||
share = true;
|
||||
};
|
||||
|
||||
# Session variables (migrated from dot_zshrc and 01-env.sh)
|
||||
sessionVariables = {
|
||||
# XDG runtime directory
|
||||
XDG_RUNTIME_DIR = "\${XDG_RUNTIME_DIR:-$HOME/.cache}";
|
||||
|
||||
# Locale
|
||||
LANG = "en_US.UTF-8";
|
||||
|
||||
# Temporary directory
|
||||
TMPDIR = "\${TMPDIR:-/tmp}";
|
||||
|
||||
# Editor (from 01-nvim.sh)
|
||||
EDITOR = "nvim";
|
||||
|
||||
# GPG TTY for SSH sessions
|
||||
GPG_TTY = "$(tty)";
|
||||
|
||||
# FZF Catppuccin color scheme (from dot_zshrc)
|
||||
FZF_DEFAULT_OPTS = lib.concatStringsSep " " [
|
||||
"--color=bg+:#313244,bg:#1e1e2e,spinner:#f5e0dc,hl:#f38ba8"
|
||||
"--color=fg:#cdd6f4,header:#f38ba8,info:#cba6f7,pointer:#f5e0dc"
|
||||
"--color=marker:#f5e0dc,fg+:#cdd6f4,prompt:#cba6f7,hl+:#f38ba8"
|
||||
];
|
||||
|
||||
# NVM directory
|
||||
NVM_DIR = "$HOME/.nvm";
|
||||
};
|
||||
|
||||
# Shell aliases (migrated from 01-env.sh and 01-nvim.sh)
|
||||
shellAliases = {
|
||||
# Modern CLI replacements (from 01-env.sh)
|
||||
ls = "eza";
|
||||
cat = "bat";
|
||||
grep = "rg";
|
||||
diff = "delta";
|
||||
less = "bat";
|
||||
|
||||
# Neovim alias (from 01-nvim.sh)
|
||||
vim = "nvim";
|
||||
|
||||
# Git root navigation (from 01-env.sh)
|
||||
gr = "if [ \"`git rev-parse --show-cdup`\" != \"\" ]; then cd `git rev-parse --show-cdup`; fi";
|
||||
};
|
||||
|
||||
# Additional initialization (initExtra)
|
||||
# This runs after the shell is initialized
|
||||
initContent = ''
|
||||
# Source custom env file if it exists
|
||||
[ -f ~/.env ] && source ~/.env
|
||||
|
||||
# NVM initialization
|
||||
# Load NVM if installed via Homebrew
|
||||
if [ -s "/opt/homebrew/opt/nvm/nvm.sh" ]; then
|
||||
source "/opt/homebrew/opt/nvm/nvm.sh"
|
||||
fi
|
||||
# Load NVM bash completion
|
||||
if [ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ]; then
|
||||
source "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm"
|
||||
fi
|
||||
|
||||
# Pinentry configuration for SSH sessions
|
||||
if [[ -n "$SSH_CONNECTION" ]]; then
|
||||
export PINENTRY_USER_DATA="USE_CURSES=1"
|
||||
fi
|
||||
|
||||
# Welcome banner (from dot_zshrc)
|
||||
# Only show if terminal is wide enough
|
||||
if [ `tput cols` -gt "70" ]; then
|
||||
function PRINT_CENTER {
|
||||
COLS=`tput cols`
|
||||
OFFSET=$(( ($COLS - $1) / 2 ))
|
||||
PRE=""
|
||||
for i in `seq $OFFSET`; do
|
||||
PRE="$PRE "
|
||||
done
|
||||
while IFS= read -r line; do
|
||||
echo "$PRE$line"
|
||||
done <<< "$2"
|
||||
}
|
||||
PRINT_CENTER 60 "
|
||||
|
||||
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
|
||||
█░▄▄▀█▀▄▄▀█░▄▄░█▄░▄█▀▄▀██░▄░██░██░█░▄▄█░▄▄░█
|
||||
█░▀▀▄█░██░█░▀▄░██░██░█▀█░▀▀░▀█░██░█▄▄▀███▄██
|
||||
█▄█▄▄██▄▄██░▀▀░██▄███▄█████░███▄▄▄█▄▄▄█░▀▀░█
|
||||
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
|
||||
|
||||
⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣿⣶⣿⣦⣼⣆
|
||||
⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦
|
||||
⠈⢿⣿⣟⠦ ⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄
|
||||
⣸⣿⣿⢧ ⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄
|
||||
⢠⣿⣿⣿⠈ ⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀
|
||||
⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿⠄
|
||||
⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄
|
||||
⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄
|
||||
⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇ ⠛⠻⢷⣄
|
||||
⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆
|
||||
⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃
|
||||
▄▄▄ . ▌ ▐·▪ ▄▄▌ ▄▄▌ ▐ ▄▌▪ ▄▄▄▄▄ ▄ .▄ ▄• ▄▌▄▄▄▄▄
|
||||
▀▄.▀·▪█·█▌██ ██• ██· █▌▐███ •██ ██▪▐█ ▄█▀▄ █▪██▌•██
|
||||
▐▀▀▪▄▐█▐█•▐█·██ ▪ ██▪▐█▐▐▌▐█· ▐█.▪██▀▀█▐█▌.▐▌█▌▐█▌ ▐█.▪
|
||||
▐█▄▄▌ ███ ▐█▌▐█▌ ▄ ▐█▌██▐█▌▐█▌ ▐█▌·██▌▐▀▐█▌.▐▌▐█▄█▌ ▐█▌·
|
||||
▀▀▀ . ▀ ▀▀▀.▀▀▀ ▀▀▀▀ ▀▪▀▀▀ ▀▀▀ ▀▀▀ · ▀█▄▀▪ ▀▀▀ ▀▀▀
|
||||
|
||||
> welcome x_x
|
||||
"
|
||||
fi
|
||||
'';
|
||||
|
||||
# Profile extra (runs in .zprofile)
|
||||
profileExtra = ''
|
||||
# Add Rust/Cargo to PATH
|
||||
export PATH="/opt/homebrew/opt/rustup/bin:$PATH:$HOME/.cargo/bin"
|
||||
'';
|
||||
};
|
||||
|
||||
# ==========================================================================
|
||||
# Starship Prompt
|
||||
# ==========================================================================
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
# Starship configuration can be customized here
|
||||
# settings = { };
|
||||
};
|
||||
|
||||
# ==========================================================================
|
||||
# Atuin - Shell History
|
||||
# Migrated from dot_config/atuin/config.toml
|
||||
# ==========================================================================
|
||||
# programs.atuin = {
|
||||
# enable = true;
|
||||
# enableZshIntegration = true;
|
||||
|
||||
# settings = {
|
||||
# force = true;
|
||||
# # Compact style for history display
|
||||
# style = "compact";
|
||||
|
||||
# # Vim keybindings in normal mode
|
||||
# keymap_mode = "vim-normal";
|
||||
# };
|
||||
# };
|
||||
|
||||
# ==========================================================================
|
||||
# Direnv - Directory-specific environments
|
||||
# ==========================================================================
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
|
||||
# Enable nix-direnv for better Nix integration
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
|
||||
# ==========================================================================
|
||||
# Zoxide - Smart directory navigation
|
||||
# ==========================================================================
|
||||
programs.zoxide = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
};
|
||||
|
||||
# ==========================================================================
|
||||
# FZF - Fuzzy finder
|
||||
# ==========================================================================
|
||||
programs.fzf = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
};
|
||||
|
||||
# ==========================================================================
|
||||
# NVM - Node Version Manager
|
||||
# ==========================================================================
|
||||
# NVM is installed via Homebrew and sourced in the shell
|
||||
# This allows managing multiple Node.js versions per project
|
||||
|
||||
# ==========================================================================
|
||||
# Pyenv - Python version management
|
||||
# ==========================================================================
|
||||
programs.pyenv = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user