blob: 7ec2ad1ff4b0838f78f989c7ce33209ef3dcbd11 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
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() {
if [ -n "$1" ]; then
# If an argument is provided, try to attach to it or create it.
tmux attach-session -t "$1" 2>/dev/null || tmux new-session -s "$1"
elif tmux has-session 2>/dev/null; then
# No argument? Open the alphabetical list.
tmux attach-session \; choose-tree -sZ -O name
else
# Nothing running? Fresh start.
tmux
fi
}
# 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 <system_name> (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"
}
|