-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·110 lines (91 loc) · 3.13 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/usr/bin/env bash
set -e
function zsh_install {
# oh-my-zsh
git clone https://github.com/ohmyzsh/ohmyzsh $HOME/.oh-my-zsh
# zinit
git clone https://github.com/zdharma-continuum/zinit $HOME/.zinit
mkdir -p $HOME/.zsh/plugins
mkdir -p $HOME/.zsh/themes
# plugins
git clone https://github.com/Aloxaf/fzf-tab $HOME/.zsh/plugins/fzf-tab &
git clone https://github.com/zsh-users/zsh-autosuggestions $HOME/.zsh/plugins/zsh-autosuggestions &
git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git \
$HOME/.zsh/plugins/fast-syntax-highlighting &
git clone https://github.com/rupa/z.git $HOME/.zsh/plugins/z &
git clone https://github.com/skywind3000/z.lua $HOME/.zsh/plugins/z_lua &
# themes
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git \
$HOME/.zsh/themes/powerlevel10k &
git clone https://github.com/denysdovhan/spaceship-prompt $HOME/.zsh/themes/spaceship-prompt &
echo "#ZSH_THEME=\"spaceship-prompt\"" > $HOME/theme.zsh
echo "ZSH_THEME=\"powerlevel10k\"" > $HOME/theme.zsh
}
function main {
echo installing
# move vim files
ln -s $PWD/.vimrc $HOME/.vimrc
ln -s $PWD/.vimrc.plugs $HOME/.vimrc.plugs
ln -s $PWD/.nvimrc.lua $HOME/.nvimrc.lua
if [[ ! -d $HOME/.vim ]];then
mkdir -p $HOME/.vim
fi
# move nvim files
if [[ ! -d $HOME/.config/nvim ]];then
mkdir -p $HOME/.config/nvim
fi
for FILE in `ls $PWD/.vim`
do
ln -s $PWD/.vim/$FILE $HOME/.vim/
ln -s $HOME/.vim/$FILE $HOME/.config/nvim/
done
ln -s $HOME/.vimrc $HOME/.config/nvim/init.vim
ln -s $PWD/after $HOME/.config/nvim/
# coc config for nvim
if [[ ! -d $HOME/.local/share/nvim ]];then
mkdir -p $HOME/.local/share/nvim
fi
ln -s $PWD/coc-settings.json $HOME/.local/share/nvim/coc-settings.json
# move zsh files
ln -s $PWD/.zshrc $HOME/.zshrc
if [[ ! -d $HOME/.oh-my-zsh ]];then
zsh_install
fi
# move ranger files
if [[ -d $HOME/.config/ranger ]] && [[ ! -L $HOME/.config/ranger ]] && [[ ! -L $HOME/.config/ranger/rc.conf ]];then
echo "having ranger dir, deleting..."
rm -rf $HOME/.config/ranger
fi
ln -s $PWD/ranger $HOME/.config/
# move yazi files
if [[ -d $HOME/.config/yazi ]] && [[ ! -L $HOME/.config/yazi ]] && [[ ! -L $HOME/.config/yazi/yazi.toml ]];then
echo "having yazi dir, deleting..."
rm -rf $HOME/.config/yazi
fi
ln -s $PWD/yazi $HOME/.config/
# move tmux files
ln -s $PWD/.tmux.conf $HOME/.tmux.conf
ln -s $PWD/.tmux.conf.local $HOME/.tmux.conf.local
echo finish
}
function nixpre {
# check if flake.nix exists
if [[ ! -f flake.nix ]];then
echo "flake.nix not found"
exit 1
fi
nix flake update nvim-config
nix flake update zsh-config
nix flake update ranger-config
nix flake update dev-shell
echo "preinstall done"
echo "now run: nixos-rebuild switch --flake .#[config-name]"
}
arg=$1
if [[ $arg == "main" ]];then
main
elif [[ $arg == "nixpre" ]];then
nixpre
else
echo "usage: ./install.sh [main|nixpre]"
fi