forked from geerlingguy/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
284 lines (241 loc) · 8.42 KB
/
Makefile
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
.SHELLFLAGS := -eu -o pipefail -c
MAKEFLAGS += --warn-undefined-variables
SHELL = /bin/bash
.SUFFIXES:
dotfiles = .ackrc \
.bash_profile \
.config/autostart/inputplug.desktop \
.local/bin/on-new-kbd.sh \
.vim/scripts/partial_accept.vim \
.gitconfig \
.gitignore \
.oh-my-zsh/custom/themes/afirth.zsh-theme \
.tmux.conf \
.vimrc \
.zshrc
links := $(patsubst %,$(HOME)/%,$(dotfiles))
apt := /usr/bin/apt-fast
asdf := ~/.asdf
aws := /usr/local/bin/aws
awsume := $(HOME)/.local/bin/awsume
cmake := /usr/bin/cmake
copyq := /usr/bin/copyq
curl := /usr/bin/curl
docker := /usr/bin/docker
eksctl := $(HOME)/.local/bin/eksctl
gh := /usr/bin/gh
gh-apt-repo := /etc/apt/sources.list.d/github-cli.list
git-creds := /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret
gnome-tweaks := /usr/bin/gnome-tweaks
golang_version = 1.20
golang := $(HOME)/.asdf/shims/golang
krew := $(HOME)/.asdf/shims/kubectl-krew
krew_version = 0.4.3
kubectl := $(HOME)/.asdf/shims/kubectl
kubectl_version = 1.21.14
kustomize := $(HOME)/.asdf/shims/kustomize
kustomize_version = 4.5.7
nodejs := $(HOME)/.asdf/shims/nodejs
nodejs_version := 17.9.1
nvim := /usr/bin/vim #TODO
oh-my-zsh := $(HOME)/.oh-my-zsh/oh-my-zsh.sh
tmux := /usr/bin/tmux
solarized := $(HOME)/.themes/NumixSolarizedDarkBlue
solarized_url := https://github.com/Ferdi265/numix-solarized-gtk-theme/releases/download/20230408/NumixSolarized-20230408.tar.gz
skaffold_version = 1.39.3
skaffold := $(HOME)/.asdf/shims/skaffold
pipx := $(HOME)/.local/bin/pipx
python := $(HOME)/.asdf/shims/python
vim := /usr/bin/vim
xinitrc := $(HOME)/.xinitrc
zsh := /usr/bin/zsh
zsh-auto := $(HOME)/.oh-my-zsh/custom/plugins/zsh-autosuggestions
.PHONY: all
all: $(oh-my-zsh) $(zsh-auto) $(links) $(cmake) $(solarized) $(gh) $(golang) $(git-creds) $(vim) $(tmux) $(curl) $(docker) $(apt) $(asdf) $(aws) $(awsume) $(gnome-tweaks) $(copyq) gnome-desktop $(python) $(nodejs) $(kubectl) $(kustomize) $(skaffold)
.PHONY: run-once
run-once: apt-utils chrome zoom gnome-extensions
## Not idempotent targets
.PHONY: apt-utils
apt-utils:
apt-fast install -y tree ack jq p7zip pavucontrol xclip
.PHONY: gnome-extensions
gnome-extensions: gtile hidetopbar
.PHONY: gcloud
gcloud: $(curl)
sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && apt-get update -y && apt-get install google-cloud-sdk -y'
$(warning run gcloud init)
.PHONY: chrome
chrome:
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -O ~/Downloads/chrome.deb
sudo apt install ~/Downloads/chrome.deb
.PHONY: zoom
zoom:
wget https://zoom.us/client/latest/zoom_amd64.deb -O ~/Downloads/zoom.deb
sudo apt install ~/Downloads/zoom.deb --yes
.PHONY: sops
SOPS_URL=$(shell curl -s "https://api.github.com/repos/mozilla/sops/releases/latest" | grep -o "http.*sops_.*_amd64\.deb")
sops: $(curl)
wget $(SOPS_URL) -O ~/Downloads/sops.deb
sudo apt install ~/Downloads/sops.deb
## Idempotent targets
.PHONY: cmake
cmake: $(cmake)
$(cmake): $(apt)
$(apt) -y install cmake
.PHONY: gnome-tweaks
gnome-tweaks: $(gnome-tweaks)
$(gnome-tweaks): $(apt)
$(apt) -y install gnome-tweaks
# github cli
.PHONY: gh
gh: $(gh)
$(gh): $(apt) $(gh-apt-repo)
$(apt) -y install gh
mkdir -p $(HOME)/.oh-my-zsh/completions/
gh completion -s zsh > $(HOME)/.oh-my-zsh/completions/_gh
$(gh-apt-repo):
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(shell dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
$(apt) update
.PHONY: copyq
copyq: $(copyq)
$(copyq): $(apt)
$(apt) -y install copyq copyq-plugins copyq-doc
#https://asdf-vm.com/#/core-manage-asdf-vm
.PHONY: asdf
asdf: $(asdf)
$(asdf): $(apt)
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.10.2
.PHONY: python
python: $(python)
$(python): $(asdf) $(apt)
$(apt) -y install libssl-dev
-asdf plugin-add python
asdf install python latest
asdf global python latest
#https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-linux.html#cliv2-linux-install
.PHONY: aws
aws: $(aws)
$(aws): $(curl)
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "/tmp/awscliv2.zip"
unzip /tmp/awscliv2.zip -d /tmp/
sudo /tmp/aws/install
.PHONY: awsume
awsume: $(awsume)
$(awsume): $(pipx)
pipx install awsume
.PHONY: pipx
pipx: $(pipx)
$(pipx):
pip3 install --upgrade pip
python3 -m pip install --user pipx
python3 -m pipx ensurepath
.PHONY: gnome-desktop
gnome-desktop:
gsettings set org.gnome.shell.extensions.dash-to-dock autohide false
gsettings set org.gnome.shell.extensions.dash-to-dock dock-fixed false
gsettings set org.gnome.shell.extensions.dash-to-dock intellihide false
gsettings set org.gnome.desktop.background show-desktop-icons false
.PHONY: nodejs
nodejs: $(nodejs)
$(nodejs): $(asdf)
-asdf plugin-add nodejs
asdf install nodejs $(nodejs_version)
asdf global nodejs $(nodejs_version)
.PHONY: kubectl
kubectl: $(kubectl)
$(kubectl): $(asdf)
-asdf plugin-add kubectl
asdf install kubectl $(kubectl_version)
asdf global kubectl $(kubectl_version)
.PHONY: krew
krew: $(krew)
$(krew): $(asdf)
-asdf plugin-add krew
asdf install krew $(krew_version)
asdf global krew $(krew_version)
.PHONY: kustomize
kustomize: $(kustomize)
$(kustomize): $(asdf)
-asdf plugin-add kustomize
asdf install kustomize $(kustomize_version)
asdf global kustomize $(kustomize_version)
.PHONY: skaffold
skaffold: $(skaffold)
$(skaffold): $(asdf)
-asdf plugin-add skaffold
asdf install skaffold $(skaffold_version)
asdf global skaffold $(skaffold_version)
.PHONY: eksctl
UNAMES=$(shell uname -s)
eksctl: $(eksctl)
$(eksctl): $(curl)
UNAME="$$(uname -s)" && \
curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(UNAMES)_amd64.tar.gz" | tar xz -C ~/.local/bin/
mkdir -p ~/.zsh/completion/
eksctl completion zsh > ~/.zsh/completion/_eksctl
$(docker):
$(apt) install -y docker.io
sudo usermod -aG docker $(USER)
sudo systemctl enable --now docker
.PHONY: golang
$(golang): $(asdf)
-asdf plugin-add golang
asdf install golang $(golang_version)
asdf global golang $(golang_version)
# install vim-gtk3
# it's already aliased to vi in zshrc
$(vim):
which vim || $(apt) -y install vim-gtk3
$(tmux):
which tmux || $(apt) -y install tmux
git clone https://github.com/tmux-plugins/tpm $(HOME)/.tmux/plugins/tpm
@echo you may want to install tmux>=3.3 with asdf. requires bison, ncurses-dev, and flex
## dotfile links
# depends on zsh because otherwise zsh install breaks
.PHONY: dotfiles
dotfiles: $(links) | $(zsh)
$(links): $(HOME)/%: %
@mkdir -p $(@D)
ln -fsr $< $@
$(git-creds): | $(apt)
$(apt) install -y libsecret-1-0 libsecret-1-dev build-essential
sudo $(MAKE) -C /usr/share/doc/git/contrib/credential/libsecret
## ZSH
### oh-my-zsh
$(oh-my-zsh): | $(zsh) $(curl)
curl -Lo /tmp/install.sh https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh
-sh /tmp/install.sh --unattended
rm /tmp/install.sh
# will be replaced by link
rm $(HOME)/.zshrc
### zsh-auto-suggestions
$(zsh-auto): $(oh-my-zsh)
-git clone https://github.com/zsh-users/zsh-autosuggestions $(HOME)/.oh-my-zsh/custom/plugins/zsh-autosuggestions
### zsh itself
$(zsh): | $(apt)
$(apt) install -y zsh
chsh -s /usr/bin/zsh
@echo Logout and back in to use zsh
## curl
$(curl): | $(apt)
$(apt) install -y curl
## Apt-fast
$(apt):
sudo add-apt-repository -y ppa:apt-fast/stable
sudo apt-get update
sudo apt-get -y install apt-fast
## numix solarized theme
$(solarized): | $(apt)
mkdir -p $(@D) && \
cd $(@D) && \
wget -nc -O $(HOME)/Downloads/NumixSolarized.tar.gz --no-check-certificate $(solarized_url) || \
echo already downloaded theme && \
tar --strip-components=1 -xvzf $(HOME)/Downloads/NumixSolarized.tar.gz && \
gsettings set org.gnome.desktop.interface gtk-theme $(@F)
hidetopbar:
./install-gnome-extensions.sh --enable 545
dconf load /org/gnome/shell/extensions/$@/ < ./[email protected]
gtile:
./install-gnome-extensions.sh --enable 28
dconf load /org/gnome/shell/extensions/$@/ < ./[email protected]