221 lines
6.4 KiB
Nix
221 lines
6.4 KiB
Nix
{
|
|
config,
|
|
pkgs,
|
|
lib,
|
|
...
|
|
}:
|
|
|
|
{
|
|
programs.bat = {
|
|
enable = true;
|
|
config = {
|
|
theme = "base16";
|
|
};
|
|
};
|
|
|
|
programs.lsd = {
|
|
enable = true;
|
|
enableZshIntegration = false; # We explicitly define custom aliases below
|
|
};
|
|
|
|
programs.fzf = {
|
|
enable = true;
|
|
enableZshIntegration = true;
|
|
defaultOptions = [
|
|
"--color=dark"
|
|
"--color=fg:-1,bg:-1,hl:#c678dd,fg+:#ffffff,bg+:#4b5263,hl+:#d858fe"
|
|
"--color=info:#98c379,prompt:#61afef,pointer:#be5046,marker:#e5c07b,spinner:#61afef,header:#61afef"
|
|
];
|
|
};
|
|
|
|
programs.zoxide = {
|
|
enable = true;
|
|
enableZshIntegration = true;
|
|
options = [
|
|
"--cmd"
|
|
"cd"
|
|
];
|
|
};
|
|
|
|
programs.zsh = {
|
|
enable = true;
|
|
enableCompletion = true;
|
|
autosuggestion.enable = true;
|
|
syntaxHighlighting = {
|
|
enable = true;
|
|
highlighters = [
|
|
"main"
|
|
"brackets"
|
|
];
|
|
};
|
|
|
|
oh-my-zsh = {
|
|
enable = true;
|
|
plugins = [
|
|
"git"
|
|
"tmux"
|
|
"battery"
|
|
"colored-man-pages"
|
|
"jsontools"
|
|
];
|
|
extraConfig = ''
|
|
COMPLETION_WAITING_DOTS="..."
|
|
ZVM_INIT_MODE="sourcing"
|
|
'';
|
|
};
|
|
|
|
plugins = [
|
|
{
|
|
name = "powerlevel10k";
|
|
src = pkgs.zsh-powerlevel10k;
|
|
file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme";
|
|
}
|
|
{
|
|
name = "fzf-tab";
|
|
src = pkgs.zsh-fzf-tab;
|
|
file = "share/fzf-tab/fzf-tab.plugin.zsh";
|
|
}
|
|
{
|
|
name = "zsh-interactive-cd";
|
|
src = pkgs.fetchFromGitHub {
|
|
owner = "changyuheng";
|
|
repo = "zsh-interactive-cd";
|
|
rev = "e7d4802aa526ec069dafec6709549f4344ce9d4a";
|
|
sha256 = "sha256-j23Ew18o7i/7dLlrTu0/54+6mbY8srsptfrDP/9BI/Q=";
|
|
};
|
|
file = "zsh-interactive-cd.plugin.zsh";
|
|
}
|
|
];
|
|
|
|
sessionVariables = {
|
|
EDITOR = "nvim";
|
|
BAT_THEME = "base16";
|
|
ZSH_TMUX_FIXTERM = "true";
|
|
GPG_TTY = "$(tty)";
|
|
PNPM_HOME = "$HOME/.local/share/pnpm";
|
|
};
|
|
|
|
shellAliases = {
|
|
vim = "nvim";
|
|
cat = "bat --paging=never";
|
|
ls = "lsd";
|
|
l = "ls -al";
|
|
clear = "clear -x";
|
|
rm = "rm -I";
|
|
zshconf = "$EDITOR $HOME/NixOS-Configs/home/zsh.nix";
|
|
hyprconf = "$EDITOR $HOME/NixOS-Configs/home/hypr/hyprland.nix";
|
|
setup = "source ./setup_env.sh";
|
|
gpuenv = "__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia";
|
|
digital = "$HOME/Tools/Digital/Digital.sh";
|
|
nixos_test = "sudo nixos_rebuild test --flake $HOME/NixOS-Configs#hades";
|
|
nixos_switch = "sudo nixos_rebuild switch --flake $HOME/NixOS-Configs#hades";
|
|
};
|
|
|
|
initContent = lib.mkMerge [
|
|
(lib.mkBefore ''
|
|
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
|
|
if [[ -r "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh" ]]; then
|
|
source "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh"
|
|
fi
|
|
'')
|
|
(lib.mkAfter ''
|
|
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
|
|
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
|
|
|
|
# Path configuration
|
|
export PATH="$HOME/.local/bin:$HOME/bin:$HOME/.cargo/bin:$PNPM_HOME:$PATH"
|
|
|
|
if [ -d "$HOME/Tools/xilinx/Vivado/2023.1/bin" ]; then
|
|
export PATH="$HOME/Tools/xilinx/Vivado/2023.1/bin:$PATH"
|
|
fi
|
|
|
|
# Miniconda / conda profile hook if installed
|
|
if [ -f /opt/miniconda3/etc/profile.d/conda.sh ]; then
|
|
source /opt/miniconda3/etc/profile.d/conda.sh
|
|
fi
|
|
|
|
# Environment modules support if available
|
|
if (( ''${+functions[module]} )) || [ -f /etc/modules/init/zsh ]; then
|
|
[ -f /etc/modules/init/zsh ] && source /etc/modules/init/zsh
|
|
module use --append "$HOME/.config/modulefiles" 2>/dev/null || true
|
|
fi
|
|
|
|
# Auto-tmux configuration
|
|
use_auto_tmux () {
|
|
! ([ -z "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] || $(pgrep -x "i3" > /dev/null || pgrep -x "sway" > /dev/null || pgrep -x "Hyprland" > /dev/null))
|
|
}
|
|
|
|
if use_auto_tmux; then
|
|
export ZSH_TMUX_AUTOSTART=true
|
|
export ZSH_TMUX_AUTOCONNECT=false
|
|
export ZSH_TMUX_AUTOQUIT=true
|
|
else
|
|
export ZSH_TMUX_AUTOSTART=false
|
|
export ZSH_TMUX_AUTOCONNECT=false
|
|
export ZSH_TMUX_AUTOQUIT=false
|
|
fi
|
|
|
|
if [[ -n "$TMUX" ]]; then
|
|
tmux-window-name() {
|
|
if [ -n "$TMUX_PLUGIN_MANAGER_PATH" ] && [ -f "$TMUX_PLUGIN_MANAGER_PATH/tmux-window-name/scripts/rename_session_windows.py" ]; then
|
|
("$TMUX_PLUGIN_MANAGER_PATH/tmux-window-name/scripts/rename_session_windows.py" &)
|
|
fi
|
|
}
|
|
autoload -Uz add-zsh-hook
|
|
add-zsh-hook chpwd tmux-window-name
|
|
fi
|
|
|
|
# Custom helper functions
|
|
perlmutter_pass () {
|
|
echo -n 'bw master password: '
|
|
read -s MASTER_PASS
|
|
echo
|
|
echo -n 'Copying passkey...'
|
|
echo "$(echo "$MASTER_PASS" | bw get password iris.nersc.gov 2>/dev/null)$(echo "$MASTER_PASS" | bw get totp iris.nersc.gov 2>/dev/null)" | wl-copy
|
|
echo 'Done.'
|
|
}
|
|
|
|
compiler_explorer () {
|
|
docker run -d -p 10240:10240 --name compiler-explorer madduci/docker-compiler-explorer
|
|
}
|
|
|
|
airplay_server () {
|
|
uxplay -p 10000 -nh -n "$(hostname)" -restrict -allow 88:66:5A:76:32:F5 -allow C4:AC:AA:76:B7:80
|
|
}
|
|
|
|
zathura_md () {
|
|
cat "$1" | pandoc -f markdown -t pdf | zathura -
|
|
}
|
|
|
|
fooocus () {
|
|
if [ -f "$HOME/Tools/Fooocus/entry_with_update.py" ]; then
|
|
"$HOME/.conda/envs/fooocus/bin/python" "$HOME/Tools/Fooocus/entry_with_update.py"
|
|
else
|
|
echo "Fooocus not found at $HOME/Tools/Fooocus"
|
|
fi
|
|
}
|
|
|
|
# Per-host / system local overrides fallback
|
|
if [ -f "$HOME/.config/zsh/$(hostname)/env.sh" ]; then
|
|
source "$HOME/.config/zsh/$(hostname)/env.sh"
|
|
elif [ -f "$HOME/.zshrc.local" ]; then
|
|
source "$HOME/.zshrc.local"
|
|
fi
|
|
|
|
# Fetch / Banner on interactive terminal start
|
|
if [[ -o interactive ]] && [ -z "$TMUX" ] && command -v pfetch >/dev/null 2>&1; then
|
|
pfetch
|
|
fi
|
|
'')
|
|
];
|
|
};
|
|
|
|
home.packages = with pkgs; [
|
|
pfetch-rs
|
|
bitwarden-cli
|
|
pandoc
|
|
zathura
|
|
tmux
|
|
];
|
|
}
|