This repository has been archived on 2024-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/common/bin/dotfiles-setup

77 lines
2.2 KiB
Plaintext
Raw Normal View History

2021-03-03 01:05:58 -06:00
#!/usr/bin/env fish
2021-03-25 09:04:51 -05:00
# This script's purpose is to setup the dotfiles configuration for an existing
# and provisioned machine. For provisioning, see `./dotfiles-init`.
2021-03-03 01:05:58 -06:00
set dfp (realpath (dirname (status -f))/../..)
set lock_file $HOME/.using-lytedev-dotfiles.lock
2021-03-06 22:07:30 -06:00
if not test -f $lock_file
2021-11-03 12:01:43 -05:00
echo "This will delete existing files. Make sure you know what you're doing."
echo 'Are you sure you want to continue? [y/N]'
2021-05-10 13:29:39 -05:00
read response
2021-03-06 22:07:30 -06:00
set response (string lower $response)
if string match $response y
echo "agreed" > "$lock_file"
else
exit 1
end
end
2021-03-03 01:05:58 -06:00
set -q XDG_CONFIG_HOME || set XDG_CONFIG_HOME $HOME/.config
2021-03-06 22:07:30 -06:00
set h $HOME; set c $XDG_CONFIG_HOME
if test -d $c/lytedev-env
echo "Warning: no environment-specific configuration detected!"
2021-03-03 01:05:58 -06:00
end
2021-03-06 22:07:30 -06:00
function l -a dot -a target -d "Symlink a dotfile configuration file or directory"
if test -L $target || test -f $target || test -d $target
rm -rf "$target"
end
# check if the directory that will contain the link exists
set -l d (dirname $target)
test -d $d || mkdir -p $d
ln -s (pwd)/$dot $target
echo Linked $dot to $target
end
2021-03-03 01:05:58 -06:00
2021-03-06 22:07:30 -06:00
pushd $dfp
2021-03-03 01:05:58 -06:00
l common/tmux/conf $h/.tmux.conf
2022-12-13 13:41:40 -06:00
test -d ~/.tmux/pluginx/tpm || \
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
l common/zellij $c/zellij
2021-03-03 01:05:58 -06:00
l common/fish $c/fish
2021-11-03 12:01:43 -05:00
l common/bash/rc $h/.bashrc
2021-03-03 01:05:58 -06:00
l common/neovim $c/nvim
2021-05-29 22:52:00 -05:00
l common/wezterm $c/wezterm
2021-03-03 01:05:58 -06:00
l common/colors/vim $c/nvim/colors/base16-donokai.vim
l common/weechat $h/.weechat
l common/scim/rc $h/.scimrc
l common/scim/lua $h/.scim/lua
l common/nnn $c/nnn
l common/kak $c/kak
2022-01-19 10:06:05 -06:00
l common/helix $c/helix
2021-03-03 01:05:58 -06:00
l common/gpg/agent.conf $h/.gnupg/gpg-agent.conf
l common/htop/rc $c/htop/htoprc
l common/kitty $c/kitty
2022-12-13 13:41:40 -06:00
l common/alacritty $c/alacritty
2021-11-08 23:41:55 -06:00
l common/pgcli $c/pgcli
2021-05-29 22:52:00 -05:00
l common/mutt/rc $h/.muttrc
2021-03-03 01:05:58 -06:00
l common/git/config $h/.gitconfig
l common/elixir/iex.exs $h/.iex.exs
2021-11-08 23:41:55 -06:00
l common/blender/userpref.blend $c/blender/2.93/config/userpref.blend
2021-12-23 07:01:27 -06:00
l common/lemonade/config.toml $c/lemonade.toml
2021-03-06 22:07:30 -06:00
popd
2021-03-03 01:05:58 -06:00
2021-03-06 22:07:30 -06:00
for s in $c/lytedev-env/*/dotfiles-setup.d.fish
source $s $dfp $h $c
end
2021-03-03 01:05:58 -06:00
2022-12-28 02:06:42 -06:00
rm -f $ENV_PATH/empty
ln -s $DOTFILES_PATH/common/empty-env $ENV_PATH/empty
2021-03-03 01:05:58 -06:00
# execute the user's shell
2021-11-03 12:01:43 -05:00
set ush (getent passwd (whoami) | cut -d: -f7)
2021-03-25 09:04:51 -05:00
echo "Dotfiles Installed! Don't forget to setup environments!"
2021-03-03 01:05:58 -06:00
exec $ush