fix(distrobox): Remove nix from $PATH when in Distrobox container

This commit is contained in:
Jiří Štefka 2024-05-14 10:30:07 +02:00
parent 98a327eb13
commit 8f57a2b282
Signed by: jiriks74
GPG Key ID: 1D5E30D3DB2264DE

31
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";