Merge branch 'master' of git.mvl.sh:vleeuwenmenno/dotfiles

This commit is contained in:
Menno van Leeuwen 2024-11-01 15:15:45 +01:00
commit 0ce9081a75
Signed by: vleeuwenmenno
SSH Key Fingerprint: SHA256:OJFmjANpakwD3F2Rsws4GLtbdz1TJ5tkQF0RZmF0TRE
3 changed files with 31 additions and 4 deletions

18
.bashrc
View File

@ -89,18 +89,28 @@ fi
eval "$(starship init bash)" eval "$(starship init bash)"
# Source nix home-manager # Source nix home-manager
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" if [ -f "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" ]; then
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
fi
# Source agent-bridge script for 1password # Source agent-bridge script for 1password
source $HOME/dotfiles/bin/1password-agent-bridge.sh source $HOME/dotfiles/bin/1password-agent-bridge.sh
# zoxide # zoxide if available
eval "$(zoxide init bash)" if command -v zoxide &> /dev/null; then
eval "$(zoxide init bash)"
fi
# Check if we are running from zellij, if not then launch it # Check if we are running from zellij, if not then launch it
if [ -z "$ZELLIJ" ]; then if [ -z "$ZELLIJ" ]; then
zellij zellij
exit $?
# Exit if zellij exits properly with a zero exit code
if [ $? -eq 0 ]; then
exit $?
fi
echo "Zellij exited with a non-zero exit code, continuing..."
return return
fi fi

View File

@ -214,6 +214,18 @@ homemanager() {
cd $HOME/dotfiles/config/home-manager && NIXPKGS_ALLOW_UNFREE=1 home-manager switch cd $HOME/dotfiles/config/home-manager && NIXPKGS_ALLOW_UNFREE=1 home-manager switch
} }
ensure_homemanager_installed() {
if [ ! -x "$(command -v home-manager)" ]; then
printfe "%s\n" "yellow" "Home Manager is not installed, installing it..."
nix-channel --add https://github.com/nix-community/home-manager/archive/release-24.05.tar.gz home-manager
nix-channel --update
nix-shell '<home-manager>' -A install
printfe "%s\n" "yellow" "Home Manager installed, please run the script again."
exit 1
fi
}
#################################################################################################### ####################################################################################################
# Parse arguments # Parse arguments
#################################################################################################### ####################################################################################################
@ -228,6 +240,7 @@ shift
if [ "$#" -eq 0 ]; then if [ "$#" -eq 0 ]; then
printfe "%s\n" "yellow" "No options passed, running full update..." printfe "%s\n" "yellow" "No options passed, running full update..."
ensure_homemanager_installed
symlinks symlinks
sys_packages sys_packages
homemanager homemanager

View File

@ -17,6 +17,10 @@ if [ ! -x "$(command -v sed)" ]; then
return return
fi fi
if [ ! -f ~/.bashrc ]; then
touch ~/.bashrc
fi
sed -i -e '$a\'$'\n''export PATH=$PATH:$HOME/.local/bin' ~/.bashrc sed -i -e '$a\'$'\n''export PATH=$PATH:$HOME/.local/bin' ~/.bashrc
sed -i -e '$a\'$'\n''export PATH=$PATH:~/dotfiles/bin' ~/.bashrc sed -i -e '$a\'$'\n''export PATH=$PATH:~/dotfiles/bin' ~/.bashrc