Files
Nixos-Config/modules/user/shell.nix
2026-04-20 15:08:47 +00:00

81 lines
1.9 KiB
Nix

# ==========================================
# SHELL CONFIGURATION (Zsh)
# ==========================================
# Omarchy-style: Oh-My-Zsh + modern CLI replacements
# ==========================================
{ config, pkgs, ... }:
{
# Atuin — searchable shell history
programs.atuin = {
enable = true;
enableZshIntegration = true;
settings = {
auto_sync = false;
search_mode = "fuzzy";
};
};
# Zsh
programs.zsh = {
enable = true;
enableCompletion = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
shellAliases = {
# Rebuild shortcuts
upd = "cd ~/nixos-config && sudo nixos-rebuild switch --flake . && echo 'Done!'";
upd-test = "cd ~/nixos-config && sudo nixos-rebuild test --flake .";
upd-build = "cd ~/nixos-config && nixos-rebuild dry-build --flake .";
# Modern replacements
ls = "eza --icons";
ll = "eza -la --icons";
lt = "eza -la --icons --tree --level=2";
cat = "bat --style=plain";
find = "fd";
# Clipboard (Wayland)
pbcopy = "wl-copy";
pbpaste = "wl-paste";
# Docker
lzd = "lazydocker";
# Git
lg = "lazygit";
};
oh-my-zsh = {
enable = true;
theme = "gnzh";
plugins = [
"git"
"docker"
"docker-compose"
"eza"
"zoxide"
"colored-man-pages"
"fzf"
];
};
initContent = ''
# Force Atuin up-arrow binding
bindkey '^[[A' atuin-up-search
bindkey '^[OA' atuin-up-search
# Yazi wrapper cd on exit
function y() {
local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd
yazi "$@" --cwd-file="$tmp"
if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
builtin cd -- "$cwd"
fi
rm -f -- "$tmp"
}
'';
};
}