Files
nixos-config/docs/reference/shell.md
T
kiskaadee 1ceeca785f docs(secrets,shell): document two-tier secrets model and operator CLI wrappers
- Document Two-Tier Secrets Architecture separating Workstation Operator Secrets (Config/secrets.yaml) from Server Runtime Secrets (Core/nixos/secrets.yaml)
- Document flarectl and hostinger transparent in-memory secret wrappers in docs/reference/shell.md
2026-10-21 12:03:43 -05:00

82 lines
3.5 KiB
Markdown

# 🐚 Shell & CLI Environment Reference
This document catalogs the interactive Bash shell configuration, Starship prompt integration, and custom helper scripts managed in `home/shell.nix` and `home/shell/`.
---
## 1. Shell Configuration Architecture
The shell environment is modularized:
- **`home/shell.nix`**: Core Home Manager bash module, aliases, environment exports, and tool integrations (Direnv, Starship, Fastfetch).
- **`home/shell/`**: Domain-specific sourced shell scripts:
- `git.sh`: Git helper functions and branch utilities.
- `jump.sh`: Directory navigation and quick jumping.
- `pdf.sh`: PDF compilation, viewing, and OCR helpers.
- `quicklinks.sh`: Shortcuts to primary project directories.
- `secrets.sh`: SOPS secret retrieval (`gh-token` clipboard utility, transparent `flarectl` and `hostinger` process wrappers).
- `todo.sh`: Lightweight terminal task tracking.
- `wayland.sh`: Wayland session environment variables and clipboard helpers.
---
## 2. Shell Aliases & Shortcuts
### System & Navigation
| Alias | Target Command | Purpose |
| :--- | :--- | :--- |
| `c` | `clear` | Clear terminal scrollback. |
| `q` | `exit` | Close shell session. |
| `ls` | `eza --icons` | Modern directory listing. |
| `ll` | `eza -la --icons` | Detailed directory listing. |
| `tree` | `eza --tree --icons` | Directory tree visualization. |
| `cat` | `bat --paging=never` | Syntax-highlighted file viewing. |
### Git & Workflows
| Alias | Target Command | Purpose |
| :--- | :--- | :--- |
| `gs` | `git status` | Quick working tree status. |
| `gd` | `git diff` | Syntax-highlighted git diff via Delta. |
| `gl` | `git log --oneline --graph --decorate` | Compact visual commit graph. |
| `ght` | `gh-token` | Copy GitHub repo token from SOPS into Wayland clipboard. |
### Operator CLI Secret Wrappers (`home/shell/secrets.sh`)
| Command / Function | Injected Environment Variables | Source Secret Key (`~/Config/secrets.yaml`) |
| :--- | :--- | :--- |
| `flarectl` | `CF_API_TOKEN`, `CF_ACCOUNT_ID` | `["cloudflare"]["api_token"]`, `["cloudflare"]["account_id"]` |
| `hostinger` | `HOSTINGER_API_TOKEN` | `["hostinger"]["api_token"]` |
| `gh-token` (`ght`) | *(Copies directly to Wayland clipboard)* | `["system"]["gh_repo_token"]` (from Homelab `Core`) |
*Note: Environment variables are set exclusively for the child process lifecycle and do not persist in your interactive shell.*
### Directory Navigation Jumps (`home/shell/jump.sh`)
| 2-Letter | Word Alias | Target Directory | Description |
| :--- | :--- | :--- | :--- |
| `br` | `brain` | `~/Brain` | Second brain knowledge base. |
| `cf` | `conf` / `cfg` | `~/Config` | Declarative NixOS configuration. |
| `dc` | `doc` / `docs` | `~/Documents` | Personal documents. |
| `dl` | `dl` | `~/Downloads` | Downloads folder. |
| `pi` | `pic` / `pict` | `~/Pictures` | Wallpapers, images, screenshots. |
| `pj` | `pj` / `prj` | `~/Projects` | Local workspace for project repositories. |
| `hl` | `hl` / `homelab` | `~/Homelab` | Local workspace for homelab repositories. |
---
## 3. Modular Shell Scripts (`home/shell/`)
All files in `home/shell/*.sh` are automatically sourced during interactive bash startup:
```bash
for script in ~/.config/bash/*.sh; do
[ -r "$script" ] && source "$script"
done
```
### Adding a New Shell Extension
To add new bash functions or aliases:
1. Create a new `.sh` file under `home/shell/<topic>.sh`.
2. Add the source link in `home/shell.nix`:
```nix
home.file.".config/bash/<topic>.sh".source = ./shell/<topic>.sh;
```
3. Rebuild and restart the shell.