alias cp='cp -iv' alias rm='rm -iv' alias mv='mv -iv' # Git alias lg='lazygit' alias gs='git status' alias ga='git add' alias gb='git branch' alias gc='git commit' alias gd='git diff' alias go='git checkout' alias gl='git log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short' # Nixos alias ras='sudo nixos-rebuild switch --flake .#' # Tmux tm() { # Handle specific session attachment (standard behavior). if [ -n "$1" ]; then tmux attach-session -t "$1" 2>/dev/null || tmux new-session -s "$1" return fi # If no tmux server is running at all. if ! tmux has-session 2>/dev/null; then # Start a dummy session in the background to kickstart the server. tmux new-session -d -s "init" # Trigger the restore script. RESURRECT_SCRIPT="$HOME/.config/tmux/plugins/tmux-resurrect/scripts/restore.sh" if [ -f "$RESURRECT_SCRIPT" ]; then tmux run-shell "$RESURRECT_SCRIPT" # Kill the dummy session once restored. tmux kill-session -t "init" 2>/dev/null fi fi # Attach and show the tree. tmux attach-session -t "main" 2>/dev/null || tmux attach-session \; choose-tree -sZ -O name } # Edit NixOS Sops secret files. se() { local SYSTEM=$1 local REPO_ROOT="$HOME/.nixos" local SECRET_PATH="$REPO_ROOT/systems/$SYSTEM/secrets/secrets.yaml" if [ -z "$SYSTEM" ]; then echo "Usage: se (e.g., se suliman)" return 1 fi if [ ! -f "$SECRET_PATH" ]; then echo "Error: Secret file not found at $SECRET_PATH" echo "Creating new secret file for $SYSTEM..." mkdir -p "$(dirname "$SECRET_PATH")" fi nix shell nixpkgs#sops -c sops "$SECRET_PATH" }