refactor(home-manager): refine CLI feature configurations

- Add direnv module with nix-direnv integration, replacing manual hook
- Disable starship's add_newline for more compact prompt
- Clean up comments across CLI features for better readability
This commit is contained in:
♥ Minnie ♥ 2025-10-27 13:56:01 +08:00
parent bdf7c14c6c
commit e18635be43
Signed by: jasmine
GPG key ID: 8563E358D4E8040E
5 changed files with 26 additions and 22 deletions

View file

@ -0,0 +1,15 @@
{
# Automatic environment variable management per-directory
programs.direnv = {
enable = true;
# Faster nix-shell integration with dependency caching
nix-direnv.enable = true;
# Hook into zsh
enableZshIntegration = true;
# Suppress logging output
silent = true;
};
}

View file

@ -3,13 +3,13 @@
enable = true;
enableZshIntegration = true;
settings = {
# Left prompt: username@hostname directory git ♥
format = "$username$hostname$directory$git_branch$git_status$character";
add_newline = false;
# Right prompt: language indicators
# Prompt layout
format = "$username$hostname$directory$git_branch$git_status$character";
right_format = "$c$direnv$haskell$bun$python$rust";
# Blue username
# Always show username
username = {
style_user = "blue";
style_root = "red";
@ -17,14 +17,14 @@
show_always = true;
};
# Blue @hostname
# Show hostname even when not over SSH
hostname = {
ssh_only = false;
format = "[@$hostname]($style) ";
style = "blue";
};
# Cyan directory
# Full path, no truncation
directory = {
style = "cyan";
format = "[$path]($style) ";
@ -32,12 +32,10 @@
truncate_to_repo = false;
};
# Git branch (purple, no bold)
git_branch = {
style = "purple";
};
# Git configuration
git_branch.style = "purple";
# Git status with semantic colors (no bold, no brackets)
# Semantic colors for git status indicators
git_status = {
format = "$conflicted$stashed$deleted$renamed$modified$staged$untracked$ahead_behind";
conflicted = "[=$count](red) ";
@ -52,19 +50,14 @@
deleted = "[$count](red) ";
};
# Heart prompt character (red in insert mode, blue in normal mode)
# Vi-mode aware prompt character
character = {
success_symbol = "[](red)";
error_symbol = "[](red)";
vicmd_symbol = "[](blue)";
};
# Language modules for right prompt (only configure non-defaults)
# Enable direnv (disabled by default)
direnv.disabled = false;
# C, Python, Haskell, Bun, Rust: use defaults
};
};
}

View file

@ -1,5 +1,6 @@
{pkgs, ...}: {
imports = [
./direnv.nix
./starship.nix
];
@ -47,7 +48,6 @@
# Extra commands that should be added to '.zshrc'
initContent = ''
eval "$(direnv hook zsh)"
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
export PATH

View file

@ -27,8 +27,6 @@
# Configure programs
programs = {
zsh.enable = true;
# Load and unload environment variables
direnv.enable = true;
# Android debug bridge: communicate with devices
adb.enable = true;
};

View file

@ -37,8 +37,6 @@
# Configure programs
programs = {
zsh.enable = true;
# Load and unload environment variables
direnv.enable = true;
};
# Manage linux containers