This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

zsh: add tmux integration and refactor package

+41 -8
+41 -8
tools/zsh/flake-module.nix
··· 178 178 esac 179 179 180 180 181 + # Auto-start tmux for new sessions 182 + if [[ "$TERM" != "linux" && -z "$TMUX" && "$TERM" != "dumb" ]]; then 183 + # Preserve SSH_AUTH_SOCK for tmux 184 + if [[ -n "$SSH_AUTH_SOCK" ]]; then 185 + tmux set-environment -g SSH_AUTH_SOCK "$SSH_AUTH_SOCK" 2>/dev/null 186 + fi 187 + 188 + # Start tmux with a new session 189 + exec tmux -u new-session 190 + fi 191 + 192 + # Set tmux status bar color based on hostname for SSH sessions 193 + if [[ -n "$TMUX" && "$__host__" != "$HOST" ]]; then 194 + # Generate a color based on hostname hash 195 + color=$(( $(echo -n "$HOST" | od -An -N4 -tu4) % 255 )) 196 + tmux set -g status-bg "colour$color" 2>/dev/null || true 197 + export __host__="$HOST" 198 + fi 199 + 181 200 # Disable some features to support TRAMP. 182 201 if [ "$TERM" = dumb ]; then 183 202 unsetopt zle prompt_cr prompt_subst ··· 188 207 ''; 189 208 in 190 209 { 191 - packages.zsh = 192 - (pkgs.writeScriptBin "zsh" '' 193 - #!/bin/sh 194 - export ZDOTDIR=${pkgs.writeTextDir "/.zshrc" zshrc} 195 - exec ${pkgs.zsh}/bin/zsh "$@" 196 - '') 197 - // { 198 - zshrc = zshrc; 210 + packages.zsh = pkgs.symlinkJoin { 211 + name = "zsh-with-config"; 212 + paths = [ 213 + (pkgs.writeShellApplication { 214 + name = "zsh"; 215 + runtimeInputs = with pkgs; [ 216 + tmux 217 + fzf 218 + direnv 219 + atuin 220 + nix-index 221 + ]; 222 + text = '' 223 + export ZDOTDIR=${pkgs.writeTextDir "/.zshrc" zshrc} 224 + exec ${pkgs.zsh}/bin/zsh "$@" 225 + ''; 226 + }) 227 + pkgs.zsh 228 + ]; 229 + passthru = { 230 + inherit zshrc; 199 231 }; 232 + }; 200 233 }; 201 234 }