From 8f57a2b28221507234deaa3600539b47dd8bfefc Mon Sep 17 00:00:00 2001 From: jiriks74 Date: Tue, 14 May 2024 10:30:07 +0200 Subject: [PATCH] fix(distrobox): Remove `nix` from $PATH when in Distrobox container --- zsh.nix | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/zsh.nix b/zsh.nix index 8b320c5..f9682eb 100755 --- a/zsh.nix +++ b/zsh.nix @@ -34,6 +34,12 @@ }; initExtra = '' + # Remove nix from path if we are in a container (distrobox) + if [ -v DISTROBOX_ENTER_PATH ]; then + export PATH=$(echo $PATH | tr ':' '\n' | grep -vE '/nix/|/run/wrappers|\.nix-profile|/etc/profiles/per-user/jirka/bin|/run/current-system/sw/bin' | tr '\n' ':') + export PATH=$(echo $PATH | sed 's/:$//') + fi + # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh # case $(tty) in @@ -104,6 +110,19 @@ alias put="kitty +kitten transfer --direction=upload" alias kclip="kitty +kitten clipboard" fi + + # Special aliases that may not work with Nix config + # Command line head / tail shortcuts + alias H="| head"; + alias T="| tail"; + alias G="| grep"; + alias L="| less"; + alias M="| most"; + alias LL="2>&1 | less"; + alias CA="2>&1 | cat -A"; + alias NE="2> /dev/null"; + alias NUL="> /dev/null 2>&1"; + alias P="2>&1| pygmentize -l pytb"; ''; shellAliases = { @@ -126,18 +145,6 @@ t="tail -f"; - # Command line head / tail shortcuts - H="| head"; - T="| tail"; - G="| grep"; - L="| less"; - M="| most"; - LL="2>&1 | less"; - CA="2>&1 | cat -A"; - NE="2> /dev/null"; - NUL="> /dev/null 2>&1"; - P="2>&1| pygmentize -l pytb"; - dud="du -d 1 -h"; duf="du -sh *"; # fd="find . -type d -name";