aboutsummaryrefslogtreecommitdiff
path: root/install.sh
blob: 848a9d1df7acaa3b709b4c7e7d82896dd95da3a7 (plain) (blame)
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#!/bin/sh

set -e

symlink () {
    ln -sfT "$@"
}

install_packages() {
    yay -S --needed --noconfirm \
        $(cat $1 | \
          xargs -I{} sh -c \
            "(pacman -Q {} &> /dev/null) || echo {}")
}

install_python() {
    LONG=$1
    SHORT=${LONG//\./}

    PYTHON_BIN=$(command -v "python$LONG")
    if [ ! -z $PYTHON_BIN ]; then

        PYTHON_DIR=~/opt/python$SHORT
        PIP_BIN=$PYTHON_DIR/bin/pip$LONG
        REQUIREMENTS=~/.dotfiles/python/requirements.pip$SHORT.txt
        LOCAL_PYTHON_BIN=~/bin/python$LONG
        LOCAL_PIP_BIN=~/bin/pip$LONG
        LOCAL_DOIT_BIN=~/bin/doit$LONG

        [ ! -d $PYTHON_DIR ] && \
            $PYTHON_BIN -m venv --system-site-packages $PYTHON_DIR

        $PIP_BIN -q install -U -r $REQUIREMENTS

        echo "#!/bin/sh" > $LOCAL_PYTHON_BIN
        echo "exec $(cd $PYTHON_DIR; pwd)/bin/python$LONG \"\$@\"" >> $LOCAL_PYTHON_BIN
        chmod +x $LOCAL_PYTHON_BIN

        symlink $PIP_BIN $LOCAL_PIP_BIN
        symlink $PYTHON_DIR/bin/doit $LOCAL_DOIT_BIN

    fi
}

mkdir -p ~/bin
mkdir -p ~/opt
mkdir -p ~/repos
symlink $(cd $(dirname "$0"); pwd -P) ~/.dotfiles
yay --save --sudo doas
install_packages ~/.dotfiles/packages.txt

# alacritty
symlink ~/.dotfiles/alacritty ~/.config/alacritty

# bspwm
symlink ~/.dotfiles/bspwm ~/.config/bspwm

# cudatext
mkdir -p ~/.config/cudatext/settings
symlink ~/.dotfiles/cudatext/user.json ~/.config/cudatext/settings/user.json

# dunst
symlink ~/.dotfiles/dunst ~/.config/dunst

# git
symlink ~/.dotfiles/git/.gitconfig ~/.gitconfig

# i3
symlink ~/.dotfiles/i3 ~/.config/i3

# janet
if [ ! -d ~/repos/janet ]; then
    (cd ~/repos; git clone https://github.com/janet-lang/janet.git)
fi
if [ ! -d ~/opt/janet ]; then
    (cd ~/repos/janet; make install PREFIX=$(cd ~/opt; pwd -P)/janet)
fi

# lein
symlink ~/.dotfiles/lein/lein ~/bin/lein

# neomutt
symlink ~/.dotfiles/neomutt ~/.config/neomutt

# pictures
symlink ~/.dotfiles/pictures ~/.pictures

# polybar
symlink ~/.dotfiles/polybar ~/.config/polybar

# python
install_python 3.8
install_python 3.9
symlink ~/bin/python3.9 ~/bin/python3
symlink ~/bin/python3 ~/bin/python

# qutebrowser
mkdir -p ~/.config/qutebrowser
symlink ~/.dotfiles/qutebrowser/autoconfig.yml ~/.config/qutebrowser/autoconfig.yml

# ranger
mkdir -p ~/.config/ranger
symlink ~/.dotfiles/ranger/rc.conf ~/.config/ranger/rc.conf

# shell
symlink ~/.dotfiles/shell/.profile ~/.profile

# shell - bash
symlink ~/.dotfiles/shell/bash/.bashrc ~/.bashrc
symlink ~/.profile ~/.bash_profile

# shell - fish
symlink ~/.dotfiles/shell/fish ~/.config/fish

# shell - zsh
symlink ~/.dotfiles/shell/zsh/.zshrc ~/.zshrc
symlink ~/.profile ~/.zprofile

# sublimetext
mkdir -p ~/.config/sublime-text/Packages/User
for i in Adaptive.sublime-theme \
         LSP.sublime-settings \
         "Package Control.sublime-settings" \
         Preferences.sublime-settings \
         Python.sublime-settings \
         PythonImproved.sublime-settings \
         SublimeLinter.sublime-settings
do
    symlink ~/.dotfiles/sublimetext/"$i" ~/.config/sublime-text/Packages/User/"$i"
done

# sway
symlink ~/.dotfiles/sway ~/.config/sway

# tmux
symlink ~/.dotfiles/tmux/.tmux.conf ~/.tmux.conf

# vim / nvim
mkdir -p ~/.vim/autoload
mkdir -p ~/.config
symlink ~/.dotfiles/vim/.vimrc ~/.vimrc
symlink ~/.dotfiles/vim/plug.vim ~/.vim/autoload/plug.vim
symlink ~/.vimrc ~/.vim/init.vim
symlink ~/.vim ~/.config/nvim

# xorg
symlink ~/.dotfiles/xorg/.xinitrc ~/.xinitrc
symlink ~/.dotfiles/xorg/.Xresources ~/.Xresources
symlink ~/.dotfiles/xorg/loadxresources ~/bin/loadxresources
symlink ~/.dotfiles/xorg/setwallpaper ~/bin/setwallpaper