# zsh with oh-my-zsh: agnoster where glyphs render, gentoo on the console. # Deep paths are shortened to `…/last/two` so the prompt stays on one line: # `%(4~|…/%2~|%~)` shows the last two components from four levels down. { lib, ... }: { programs.zsh = { enable = true; autosuggestion.enable = true; syntaxHighlighting.enable = true; oh-my-zsh = { enable = true; plugins = [ "git" "ssh-agent" "gpg-agent" ]; # runs before oh-my-zsh is sourced extraConfig = '' # faster git status on large repositories DISABLE_UNTRACKED_FILES_DIRTY=true if [[ "$TERM" == "linux" || "$TERM" == "screen" ]]; then ZSH_THEME="gentoo" else ZSH_THEME="agnoster" fi ''; }; # runs after oh-my-zsh, once the theme's prompt exists initContent = lib.mkAfter '' if [[ "$ZSH_THEME" == "agnoster" ]]; then # agnoster renders prompt_dir on every prompt, so override it prompt_dir() { prompt_segment "$AGNOSTER_DIR_BG" "$AGNOSTER_DIR_FG" '%(4~|…/%2~|%~)' } else # gentoo builds PROMPT once; ascii dots, the console font lacks … PROMPT="''${PROMPT/\%~/%(4~|.../%2~|%~)}" fi ''; }; home.sessionVariables = { EDITOR = "vim"; NH_FLAKE = "/home/aaron/git/nixconfig"; }; }