-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
105 lines (85 loc) · 2.44 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
SHELL := /bin/bash
CONFIG_DIRS := wezterm zsh starship nvim bat ranger ghc kitty ruff mime ncdu
### Main
.PHONY: main
main: configs scripts zsh-plugins vim-plugins
.PHONY: all
all: main gitconfig dotfile-watcher nerdfonts gnome-hacks
.PHONY: configs
configs:
stow $(CONFIG_DIRS)
.PHONY: scripts
scripts:
mkdir -p ~/.local/bin
# symlink instead of alias, so that you can do stuff like fd <pattern> -X vim
ln -sf $(shell command -v nvim) ~/.local/bin/vim
stow bin
.PHONY: zsh-plugins
zsh-plugins:
git submodule init -- zsh/
git submodule update -- zsh/
.PHONY: vim-plugins
vim-plugins:
git submodule init -- nvim/
git submodule update -- nvim/
nvim --headless '+Lazy! restore' '+qa'
### Updating
.PHONY: update
update: update-zsh-plugins update-vim-plugins
.PHONY: update-zsh-plugins
update-zsh-plugins:
git submodule update --remote -- zsh/
.PHONY: update-vim-plugins
update-vim-plugins:
git submodule update --remote -- nvim/
nvim --headless '+Lazy! update' '+qa'
### Situational
.PHONY: gitconfig
gitconfig: templates
stow git --ignore='\.template'
.PHONY: package-list
.ONESHELL:
package-list:
@set -o errexit -o nounset -o pipefail
@source /etc/os-release || :
@distro=$${ID:-unknown}
@echo "Distro detection: $$distro" >&2
@if [[ ! -e "packages/$$distro.sed" ]]; then \
echo 'Warning: unknown distro, will try anyway' >&2 && \
cd packages && sed packages.txt -f uncomment.sed; \
else \
cd packages && sed packages.txt -f uncomment.sed -f "$$distro.sed"; \
fi
.PHONY: nerdfonts
.ONESHELL:
nerdfonts:
set -o errexit -o nounset -o pipefail
git clone https://github.com/ryanoasis/nerd-fonts.git /tmp/nerd-fonts \
--no-checkout --single-branch --depth 1 --filter blob:none
trap 'rm -rf /tmp/nerd-fonts' EXIT
cd /tmp/nerd-fonts
git sparse-checkout init --cone
git sparse-checkout set patched-fonts/JetBrainsMono
git checkout
./install.sh JetBrainsMono
.PHONY: gnome-hacks
gnome-hacks:
mkdir -p ~/.local/bin
# open *.desktop terminal apps in kitty
ln -sf $(shell command -v kitty) ~/.local/bin/gnome-terminal
### Templating
.PHONY: templates
templates: .env
source .env && fd --hidden -e template -x bin/.local/bin/render-env.sh {}
.PHONY: choose-env
choose-env:
@fd . envs -t f \
| fzf \
--preview='bat -p --color always {} --line-range :50' \
--height=20 \
--prompt='choose environment> ' \
| xargs -I{} ln -sf {} .env
.PHONY: dotfile-watcher
dotfile-watcher:
stow dotfile-watcher
systemctl --user enable dotfile-watcher.path --now