install: reorganize to mirror $HOME

This commit is contained in:
Charles Gould 2022-11-15 00:36:57 -05:00
parent b759fa4886
commit 11be99c4a3
59 changed files with 12 additions and 40 deletions

View File

@ -1,16 +0,0 @@
# Path
export PATH="$HOME/bin"
export PATH="$PATH:/usr/local/bin"
export PATH="$PATH:/usr/bin"
export PATH="$PATH:/bin"
export PATH="$PATH:/usr/local/sbin"
export PATH="$PATH:/usr/sbin"
export PATH="$PATH:/sbin"
# Do not save lines which begin with a space character
# Do not save lines which match the previous history entry
# Remove from history all previous lines matching the current line
export HISTCONTROL=ignoreboth:erasedups
[ -f /usr/local/etc/bash_completion ] && source /usr/local/etc/bash_completion
[ -f $HOME/.sdkman/bin/sdkman-init.sh ] && source $HOME/.sdkman/bin/sdkman-init.sh

View File

@ -9,7 +9,7 @@ found_nix_command=0
for profile in "$HOME/.nix-profile" "/nix/var/nix/profiles/default" for profile in "$HOME/.nix-profile" "/nix/var/nix/profiles/default"
do do
if test -x "$profile/bin/nix-env"; then if test -x "$profile/bin/nix-env"; then
"$profile/bin/nix-env" --install --remove-all --file "$ROOTDIR/nix/packages.nix" "$profile/bin/nix-env" --install --remove-all --file "$ROOTDIR/.config/nix/packages.nix"
found_nix_command=1 found_nix_command=1
break break
fi fi

View File

@ -4,31 +4,19 @@ echo "***** INSTALL SYMLINKS *****"
ROOTDIR=$(cd "$(dirname "$0")/.." && pwd) ROOTDIR=$(cd "$(dirname "$0")/.." && pwd)
backup_existing() {
if [ -e "$1" ]; then
if [ ! -L "$1" ]; then
mv -v "$1" "$1.backup"
fi
fi
}
# Backup configs that are not already symlinked
backup_existing "$HOME/.bashrc"
backup_existing "$HOME/.config/fish"
backup_existing "$HOME/.config/git"
backup_existing "$HOME/.config/nix"
backup_existing "$HOME/.config/nvim"
backup_existing "$HOME/.config/sbt"
# Create config directory if not present # Create config directory if not present
mkdir -p "$HOME/.config" mkdir -p "$HOME/.config"
# Create symlinks, forcing updates for srcdir in $(find "$ROOTDIR/.config" -mindepth 1 -maxdepth 1 -type d); do
ln -fnsv "$ROOTDIR/bash/.bashrc" "$HOME/.bashrc" # Bash does not support XDG config dstdir="$HOME/.config/$(basename $srcdir)"
ln -fnsv "$ROOTDIR/fish" "$HOME/.config/fish"
ln -fnsv "$ROOTDIR/git" "$HOME/.config/git" # Backup configs that are not already symlinked
ln -fnsv "$ROOTDIR/nix" "$HOME/.config/nix" if [ -e "$dstdir" ] && [ ! -L "$dstdir" ]; then
ln -fnsv "$ROOTDIR/nvim" "$HOME/.config/nvim" mv -v "$dstdir" "$dstdir.backup"
ln -fnsv "$ROOTDIR/sbt" "$HOME/.config/sbt" fi
# Create symlinks, forcing updates
ln -fnsv "$srcdir" "$dstdir"
done
echo echo