install: reorganize to mirror $HOME
This commit is contained in:
parent
b759fa4886
commit
11be99c4a3
16
bash/.bashrc
16
bash/.bashrc
@ -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
|
@ -9,7 +9,7 @@ found_nix_command=0
|
||||
for profile in "$HOME/.nix-profile" "/nix/var/nix/profiles/default"
|
||||
do
|
||||
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
|
||||
break
|
||||
fi
|
||||
|
@ -4,31 +4,19 @@ echo "***** INSTALL SYMLINKS *****"
|
||||
|
||||
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
|
||||
mkdir -p "$HOME/.config"
|
||||
|
||||
# Create symlinks, forcing updates
|
||||
ln -fnsv "$ROOTDIR/bash/.bashrc" "$HOME/.bashrc" # Bash does not support XDG config
|
||||
ln -fnsv "$ROOTDIR/fish" "$HOME/.config/fish"
|
||||
ln -fnsv "$ROOTDIR/git" "$HOME/.config/git"
|
||||
ln -fnsv "$ROOTDIR/nix" "$HOME/.config/nix"
|
||||
ln -fnsv "$ROOTDIR/nvim" "$HOME/.config/nvim"
|
||||
ln -fnsv "$ROOTDIR/sbt" "$HOME/.config/sbt"
|
||||
for srcdir in $(find "$ROOTDIR/.config" -mindepth 1 -maxdepth 1 -type d); do
|
||||
dstdir="$HOME/.config/$(basename $srcdir)"
|
||||
|
||||
# Backup configs that are not already symlinked
|
||||
if [ -e "$dstdir" ] && [ ! -L "$dstdir" ]; then
|
||||
mv -v "$dstdir" "$dstdir.backup"
|
||||
fi
|
||||
|
||||
# Create symlinks, forcing updates
|
||||
ln -fnsv "$srcdir" "$dstdir"
|
||||
done
|
||||
|
||||
echo
|
||||
|
Loading…
x
Reference in New Issue
Block a user