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

79 lines
2.3 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
2023-07-18 10:31:57 -05:00
command rm -rf "$target"
2021-03-06 22:07:30 -06:00
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
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
2023-07-17 16:44:22 -05:00
l common/tmux/conf $h/.tmux.conf
2023-06-06 00:57:28 -05:00
l common/bat $c/bat
2021-11-03 12:01:43 -05:00
l common/bash/rc $h/.bashrc
2021-05-29 22:52:00 -05:00
l common/wezterm $c/wezterm
2023-06-06 00:57:28 -05:00
l common/kitty $c/kitty
2021-03-03 01:05:58 -06:00
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
2023-07-06 11:41:19 -05:00
l common/gitui $c/gitui
2021-03-03 01:05:58 -06:00
l common/gpg/agent.conf $h/.gnupg/gpg-agent.conf
2023-01-03 00:55:46 -06:00
chmod og-rwx ~/.gnupg
2021-03-03 01:05:58 -06:00
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
2023-07-07 12:35:53 -05:00
l common/tig/rc $h/.tigrc
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
2023-04-16 02:44:50 -05:00
set -q ENV_PATH || set ENV_PATH $XDG_CONFIG_HOME/lytedev-env
set -q DOTFILES_PATH || set DOTFILES_PATH $XDG_CONFIG_HOME/lytedev-dotfiles
2023-07-18 10:31:57 -05:00
command rm -f $ENV_PATH/empty
2022-12-28 02:06:42 -06:00
ln -s $DOTFILES_PATH/common/empty-env $ENV_PATH/empty
2023-04-13 14:04:29 -05:00
echo "Dotfiles Installed! Don't forget to setup environments and change the user's shell as needed!"
exec fish