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:
		
							parent
							
								
									bdf7c14c6c
								
							
						
					
					
						commit
						e18635be43
					
				
					 5 changed files with 26 additions and 22 deletions
				
			
		
							
								
								
									
										15
									
								
								home-manager/sajenim/features/cli/direnv.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								home-manager/sajenim/features/cli/direnv.nix
									
										
									
									
									
										Normal 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;
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -3,13 +3,13 @@
 | 
				
			||||||
    enable = true;
 | 
					    enable = true;
 | 
				
			||||||
    enableZshIntegration = true;
 | 
					    enableZshIntegration = true;
 | 
				
			||||||
    settings = {
 | 
					    settings = {
 | 
				
			||||||
      # Left prompt: username@hostname directory git ♥
 | 
					      add_newline = false;
 | 
				
			||||||
      format = "$username$hostname$directory$git_branch$git_status$character";
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      # Right prompt: language indicators
 | 
					      # Prompt layout
 | 
				
			||||||
 | 
					      format = "$username$hostname$directory$git_branch$git_status$character";
 | 
				
			||||||
      right_format = "$c$direnv$haskell$bun$python$rust";
 | 
					      right_format = "$c$direnv$haskell$bun$python$rust";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      # Blue username
 | 
					      # Always show username
 | 
				
			||||||
      username = {
 | 
					      username = {
 | 
				
			||||||
        style_user = "blue";
 | 
					        style_user = "blue";
 | 
				
			||||||
        style_root = "red";
 | 
					        style_root = "red";
 | 
				
			||||||
| 
						 | 
					@ -17,14 +17,14 @@
 | 
				
			||||||
        show_always = true;
 | 
					        show_always = true;
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      # Blue @hostname
 | 
					      # Show hostname even when not over SSH
 | 
				
			||||||
      hostname = {
 | 
					      hostname = {
 | 
				
			||||||
        ssh_only = false;
 | 
					        ssh_only = false;
 | 
				
			||||||
        format = "[@$hostname]($style) ";
 | 
					        format = "[@$hostname]($style) ";
 | 
				
			||||||
        style = "blue";
 | 
					        style = "blue";
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      # Cyan directory
 | 
					      # Full path, no truncation
 | 
				
			||||||
      directory = {
 | 
					      directory = {
 | 
				
			||||||
        style = "cyan";
 | 
					        style = "cyan";
 | 
				
			||||||
        format = "[$path]($style) ";
 | 
					        format = "[$path]($style) ";
 | 
				
			||||||
| 
						 | 
					@ -32,12 +32,10 @@
 | 
				
			||||||
        truncate_to_repo = false;
 | 
					        truncate_to_repo = false;
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      # Git branch (purple, no bold)
 | 
					      # Git configuration
 | 
				
			||||||
      git_branch = {
 | 
					      git_branch.style = "purple";
 | 
				
			||||||
        style = "purple";
 | 
					 | 
				
			||||||
      };
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      # Git status with semantic colors (no bold, no brackets)
 | 
					      # Semantic colors for git status indicators
 | 
				
			||||||
      git_status = {
 | 
					      git_status = {
 | 
				
			||||||
        format = "$conflicted$stashed$deleted$renamed$modified$staged$untracked$ahead_behind";
 | 
					        format = "$conflicted$stashed$deleted$renamed$modified$staged$untracked$ahead_behind";
 | 
				
			||||||
        conflicted = "[=$count](red) ";
 | 
					        conflicted = "[=$count](red) ";
 | 
				
			||||||
| 
						 | 
					@ -52,19 +50,14 @@
 | 
				
			||||||
        deleted = "[✘$count](red) ";
 | 
					        deleted = "[✘$count](red) ";
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      # Heart prompt character (red in insert mode, blue in normal mode)
 | 
					      # Vi-mode aware prompt character
 | 
				
			||||||
      character = {
 | 
					      character = {
 | 
				
			||||||
        success_symbol = "[♥](red)";
 | 
					        success_symbol = "[♥](red)";
 | 
				
			||||||
        error_symbol = "[♥](red)";
 | 
					        error_symbol = "[♥](red)";
 | 
				
			||||||
        vicmd_symbol = "[♥](blue)";
 | 
					        vicmd_symbol = "[♥](blue)";
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      # Language modules for right prompt (only configure non-defaults)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      # Enable direnv (disabled by default)
 | 
					 | 
				
			||||||
      direnv.disabled = false;
 | 
					      direnv.disabled = false;
 | 
				
			||||||
 | 
					 | 
				
			||||||
      # C, Python, Haskell, Bun, Rust: use defaults
 | 
					 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,6 @@
 | 
				
			||||||
{pkgs, ...}: {
 | 
					{pkgs, ...}: {
 | 
				
			||||||
  imports = [
 | 
					  imports = [
 | 
				
			||||||
 | 
					    ./direnv.nix
 | 
				
			||||||
    ./starship.nix
 | 
					    ./starship.nix
 | 
				
			||||||
  ];
 | 
					  ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -47,7 +48,6 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Extra commands that should be added to '.zshrc'
 | 
					    # Extra commands that should be added to '.zshrc'
 | 
				
			||||||
    initContent = ''
 | 
					    initContent = ''
 | 
				
			||||||
      eval "$(direnv hook zsh)"
 | 
					 | 
				
			||||||
      bindkey "^[[1;5C" forward-word
 | 
					      bindkey "^[[1;5C" forward-word
 | 
				
			||||||
      bindkey "^[[1;5D" backward-word
 | 
					      bindkey "^[[1;5D" backward-word
 | 
				
			||||||
      export PATH
 | 
					      export PATH
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -27,8 +27,6 @@
 | 
				
			||||||
  # Configure programs
 | 
					  # Configure programs
 | 
				
			||||||
  programs = {
 | 
					  programs = {
 | 
				
			||||||
    zsh.enable = true;
 | 
					    zsh.enable = true;
 | 
				
			||||||
    # Load and unload environment variables
 | 
					 | 
				
			||||||
    direnv.enable = true;
 | 
					 | 
				
			||||||
    # Android debug bridge: communicate with devices
 | 
					    # Android debug bridge: communicate with devices
 | 
				
			||||||
    adb.enable = true;
 | 
					    adb.enable = true;
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -37,8 +37,6 @@
 | 
				
			||||||
  # Configure programs
 | 
					  # Configure programs
 | 
				
			||||||
  programs = {
 | 
					  programs = {
 | 
				
			||||||
    zsh.enable = true;
 | 
					    zsh.enable = true;
 | 
				
			||||||
    # Load and unload environment variables
 | 
					 | 
				
			||||||
    direnv.enable = true;
 | 
					 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Manage linux containers
 | 
					  # Manage linux containers
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue