home-lab/documentation/CLI_TOOLS_CONSOLIDATION.md
Geir Okkenhaug Jerstad 8029d93a84 added niri
2025-06-10 20:33:54 +02:00

108 lines
4.3 KiB
Markdown

# CLI Tools Consolidation Summary
## Overview
Successfully consolidated common CLI tools from multiple user and machine configurations into `modules/common/base.nix` to reduce duplication and improve maintainability.
## Changes Made
### 1. Enhanced `modules/common/base.nix`
**Added packages:**
- Modern CLI tools (rust-based): `eza`, `bat`, `ripgrep`, `du-dust`, `bottom`, `fd`, `fzf`, `zoxide`, `tldr`
- Essential system tools: `curl`, `wget`, `git`, `htop`, `tree`, `file`, `unzip`, `zip`
- Text processing: `jq`, `yq`
- Network utilities: `nmap`
- System diagnostics: `lsof`, `strace`, `ncdu`
- Development basics: `github-cli`
- Environment management: `direnv`, `nix-direnv`
- Additional tools: `fastfetch`, `zellij`, `glances`, `systemctl-tui`, `uutils-coreutils-noprefix`
**Added aliases:**
- Editor shortcuts: `vi`/`vim``nvim`, `h``tldr`
- Modern CLI replacements: `ls``eza -l`, `cat``bat`, `grep``rg`, `top``btm`, `du``dust`, `find``fd`
- Git shortcuts: `gs`, `ga`, `gc`, `gp`, `gpa`, `gl`
- **Fixed `gpa` alias**: Now uses `git remote | xargs -L1 git push` for pushing to all remotes
### 2. Cleaned up `modules/users/common.nix`
**Removed duplicated packages:**
- `git`, `curl`, `wget`, `file`, `unzip`, `zip` (moved to base.nix)
**Removed duplicated aliases:**
- Basic CLI tool replacements (`ls`, `grep`, `find`, `cat`) moved to base.nix
- Basic git shortcuts moved to base.nix
### 3. Cleaned up `modules/users/geir.nix`
**Removed duplicated packages:**
- `wget`, `curl`, `htop`, `bottom`, `github-cli` (moved to base.nix)
### 4. Cleaned up `modules/users/sma.nix`
**Removed duplicated packages:**
- `htop`, `lsof`, `strace`, `curl`, `wget`, `tree`, `fd`, `ripgrep`, `fzf`, `ncdu`, `jq`, `yq`, `git`, `nmap` (moved to base.nix)
### 5. Cleaned up machine configurations
**reverse-proxy configuration:**
- Removed `curl`, `htop`, `bottom`, `git` (now in base.nix)
**grey-area configuration:**
- Removed `curl`, `htop`, `wget`, `git` (now in base.nix)
### 6. Cleaned up `packages/default.nix`
- Removed re-exports of `git`, `curl`, `wget` (now in base.nix)
## Benefits
1. **Reduced Duplication**: Eliminated 20+ instances of duplicated package declarations
2. **Better Maintainability**: Single source of truth for common CLI tools
3. **Consistency**: All machines get the same base set of modern CLI tools
4. **Simplified User Configs**: User-specific configs now focus on user-specific needs
5. **Easier Updates**: Update CLI tool versions in one place instead of multiple files
## Package Organization in base.nix
```nix
# Modern CLI tools (rust-based replacements)
tldr, eza, bat, ripgrep, du-dust, bottom, fd, fzf, zoxide, uutils-coreutils-noprefix
# Environment management
direnv, nix-direnv
# Essential system tools
curl, wget, git, htop, tree, file, unzip, zip
# Text processing and utilities
jq, yq
# Network utilities
nmap
# System monitoring and diagnostics
lsof, strace, ncdu
# Development basics
github-cli
```
## Verification
-`nix flake check` passes
- ✅ Dry-run build of congenital-optimist configuration succeeds
- ✅ All machines import base.nix via flake configuration
- ✅ No package conflicts or missing dependencies
## Next Steps
1. Consider creating additional specialized modules (e.g., `development/cli-tools.nix`) for development-specific tools
2. Monitor for any additional duplications as new packages are added
3. Consider consolidating shell aliases further if patterns emerge
## Final Completion Notes (Latest Updates)
### Git Alias Consolidation Completed
- **✅ `gpa` alias fixed**: Properly configured in `base.nix` to push to all remotes using `git remote | xargs -L1 git push`
- **✅ Removed duplicate**: Eliminated hardcoded `git-push-all` alias from `geir.nix` that only worked with specific remotes (origin/github)
- **✅ Better flexibility**: The generic `gpa` alias now works with any git repository configuration
### Final Status
- **✅ All consolidation complete**: CLI tools, aliases, and git functionality fully consolidated
- **✅ No remaining duplications**: Comprehensive cleanup across all configuration files
- **✅ Validation passed**: `nix flake check` and `nixos-rebuild dry-run` both successful
- **✅ Ready for deployment**: All changes tested and validated
The CLI tools consolidation project is now **100% complete** with improved git workflow capabilities.