nixos/install.sh

40 lines
1.1 KiB
Bash
Raw Normal View History

#! /usr/bin/env sh
# Install various dotfiles into their proper places
2023-01-10 10:30:42 +00:00
# Get machine for specific config locations
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) machine=Linux;;
Darwin*) machine=Mac;;
CYGWIN*) machine=Cygwin;;
MINGW*) machine=MinGw;;
*) machine="UNKNOWN:${unameOut}"
esac
echo "Machine: ${machine}"
# .config files
CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}"
mkdir -p "$CONFIG_DIR"
for FILE in config/*; do
FILENAME="$(basename $FILE)"
2023-01-10 10:30:42 +00:00
if [ ! -e "$CONFIG_DIR/$FILENAME" ]
then
2023-01-10 08:11:27 +00:00
ln -s $(readlink -f "$FILE") "$CONFIG_DIR/$FILENAME"
2023-01-10 10:30:42 +00:00
echo "$(readlink -f $FILE) -> $CONFIG_DIR/$FILENAME"
fi
done
2023-01-10 10:30:42 +00:00
# Mac specific lazygit setup (because of course)
# UPDATE: not needed if XDG_CONFIG_HOME is set
# if [ $machine == "Mac" ]
# then
# rm "$CONFIG_DIR/lazygit"
# echo "Removed $CONFIG_DIR/lazygit"
# if [ ! -e "$HOME/Library/Application Support/lazygit" ]
# then
# ln -s "$(readlink -f config/lazygit)" "$HOME/Library/Application Support/lazygit"
# echo "$(readlink -f config/lazygit) -> $HOME/Library/Application Support/lazygit"
# fi
# fi