1
0
Fork 0

improve hm-session-vars.sh sourcing and also source bash completion on macOS

This commit is contained in:
Pratham Patel 2024-02-19 09:40:30 +05:30
parent e01ffdad60
commit 9928cb402b
Signed by: thefossguy
SSH Key Fingerprint: SHA256:/B3wAg7jnMEBQ2JwkebbS/eXVZANDmqRfnd9QkIhxMI
1 changed files with 12 additions and 2 deletions

14
.bashrc
View File

@ -38,10 +38,10 @@ if [[ "$(uname -s)" == 'Linux' ]]; then
alias pbcopy='wl-copy'
fi
# source the vars only if we are not on NixOS
if ! grep 'ID=nixos' /etc/os-release > /dev/null; then
[[ -f "${HOME}/.nix-profile/etc/profile.d/hm-session-vars.sh" ]] && \
source "${HOME}/.nix-profile/etc/profile.d/hm-session-vars.sh"
SOURCE_HM_VARS=1
elif grep 'debian' /etc/os-release > /dev/null; then
export NEEDRESTART_MODE='a'
export DEBIAN_FRONTEND='noninteractive'
@ -51,6 +51,7 @@ if [[ "$(uname -s)" == 'Linux' ]]; then
elif [[ "$(uname -s)" == 'Darwin' ]]; then
GNU_LS="$(command -v gls)"
GNU_GREP="$(command -v ggrep)"
SOURCE_HM_VARS=1
alias ktb='sudo pkill TouchBarServer; sudo killall ControlStrip'
alias mpv='mpv --vo=libmpv'
@ -84,6 +85,15 @@ function tty_serial() {
fi
}
if [ "$SOURCE_HM_VARS" -eq 1 ]; then
[ -f "${HOME}/.nix-profile/etc/profile.d/hm-session-vars.sh" ] && \
source "${HOME}/.nix-profile/etc/profile.d/hm-session-vars.sh"
fi
# shellcheck disable=SC1091
[ -f "${HOME}/.local/share/nix-bash/bash_completion.sh" ] && \
source "${HOME}/.local/share/nix-bash/bash_completion.sh"
# alias wrappers to call scripts
SCRIPTS_DIR="${HOME}/.local/scripts/other-common-scripts"
alias debextract="${SCRIPTS_DIR}/extract-deb-pkg.sh"